Skip to content

Instantly share code, notes, and snippets.

@mchlstckl
Last active January 7, 2016 15:34
Show Gist options
  • Save mchlstckl/6c88230749633ef322af to your computer and use it in GitHub Desktop.
Save mchlstckl/6c88230749633ef322af to your computer and use it in GitHub Desktop.
Example logging with Kotlin
// ...elided package and imports... //
import com.example.profileservice.logging.logger
@RestController
class ProfileController @Autowired constructor(
val profileRepository: ProfileRepository
) {
// This is how you create a logger
val log = logger()
@RequestMapping("/profiles", method = arrayOf(RequestMethod.GET))
fun getProfileByEmail(
@RequestParam(value = "email") email: String
): DeferredResult<ResponseEntity<Profile>> {
// Info level logging operation
log.info("Fetching profile for email={}", email)
// ...elided controller code... //
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment