Last active
January 7, 2016 15:34
-
-
Save mchlstckl/6c88230749633ef322af to your computer and use it in GitHub Desktop.
Example logging with Kotlin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ...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