-
-
Notifications
You must be signed in to change notification settings - Fork 122
Issue #499 - improve Kotlin/JS logger #500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
The problem with JS IIRC was that there is nodejs and browser that works completely different in the sense of obtaining logger name (maybe there was another use case I don't remember right now). So the question is how do we test it to make sure we improved both cases. Also if you can provide more details on the change it will be helpful to review. |
I am referring: #279 (comment) |
Every use case is covered by test for both JS and WASM. Please, have a look at the val topLevelNamedLogger = KotlinLogging.logger("topLevelNamedLogger")
val topLevelLambdaLogger = KotlinLogging.logger {}
class MyClass {
val classNamedLogger = KotlinLogging.logger("MyClass")
val classLambdaLogger = KotlinLogging.logger {}
// check with non default "Companion" name also
companion object MyCompanion {
val companionNamedLogger = KotlinLogging.logger("MyClassCompanion")
val companionLambdaLogger = KotlinLogging.logger {}
}
} You may run these tests with current (master) implementation and find out the tests failure.
Logger name for both JS and WASM is derived via stack trace analysis to cover all use cases. Currently this is the only way to properly obtain class name for all use cases. Analysis looks like:
Also you can find description here #499 |
logger.info { "info msg" } | ||
assertEquals("INFO: [SimpleJsTest] info msg", appender.lastMessage) | ||
assertEquals("INFO: [${logger.name}] info msg", appender.lastMessage) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you change this to an explicit string param with logger name, so it will be clear what was the name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's checking via checkLoggerName(logger: KLogger, expected: String)
Closes #499