If you declare a global `val logger = KotlinLoggin...
# kotlin-logging
c
If you declare a global
val logger = KotlinLogging.logger {}
you should be able to use it anywhere.
m
But then don’t you lose the file-level tag?
c
Not sure. I haven't used a global logger. I always use a local one.
I may use a method to get a named logger if I need to send logs to specifically name logger that is configure to write to a separate file or datasource.
👍 1
m
I’m curious how kotlin-logging is able to grab the filename. Any ideas?
c
which filename?
m
the tag displayed in the logs is the filename of where you defined
val logger = KotlinLogging.logger {}
c
I think there is an implicit object named after the file where all the objects defined at file level is placed.
m
oh I see