I have a working solution using kotlin-logging and slf4j-simple. It happily prints to the console.
Question: I'd like to also send log lines to my own function so I can save them to my alternate destination (that isn't one of the built-in ones like a file).
Is there an easy interface I override? With the four layers (kotlin-logging, slf4j, slf4j-simple, Logger) I'm unsure where to start. I thought it would be as easy as
someLoggingThing.addDestinationForSufficientlySevere(object:Logger { str->
myAltLoggingThing.log(str)
})
Disclaimer: I don't know details logging practices and facades, which is why I liked the simplicity of kotlin-logging so much (the lambda handles the "don't do any thinking if debugging is turned off" issue)
private val logger = KotlinLogging.logger {}
logger.debug { "I'm a debug lumberjack and I'm ok $withComplicatedStuff" }
Its possible to do so by implementing your own logger and bind it to slf4j. So it will replace the "simpld logging". If you want both in that logger you can call the simple logger. See the details here: Implement Custom Logger with slf4j