mirror of
https://github.com/Nanaloveyuki/BitLogger.git
synced 2026-05-30 07:32:22 +00:00
18 lines
578 B
MoonBit
18 lines
578 B
MoonBit
fn main {
|
|
let config = @lib.parse_logger_config_text(
|
|
"{\"min_level\":\"debug\",\"target\":\"demo.config\",\"sink\":{\"kind\":\"text_console\",\"text_formatter\":{\"show_timestamp\":false,\"separator\":\" | \",\"template\":\"[{level}] {target} {message}\"}},\"queue\":{\"max_pending\":2,\"overflow\":\"DropOldest\"}}",
|
|
) catch {
|
|
err => {
|
|
ignore(err)
|
|
println("invalid config")
|
|
return
|
|
}
|
|
}
|
|
|
|
let logger = @lib.build_logger(config)
|
|
logger.info("queued one")
|
|
logger.info("queued two")
|
|
logger.info("queued three")
|
|
ignore(logger.flush())
|
|
}
|