mirror of
https://github.com/Nanaloveyuki/BitLogger.git
synced 2026-05-30 07:32:22 +00:00
20 lines
500 B
MoonBit
20 lines
500 B
MoonBit
fn main {
|
|
if !@lib.native_files_supported() {
|
|
println("native file sink is not available on this backend")
|
|
return
|
|
}
|
|
|
|
let logger = @lib.Logger::new(
|
|
@lib.file_sink(
|
|
"bitlogger-example.log",
|
|
auto_flush=true,
|
|
rotation=Some(@lib.file_rotation(128, max_backups=2)),
|
|
),
|
|
min_level=@lib.Level::Info,
|
|
target="demo.file",
|
|
)
|
|
logger.info("file rotation ready", fields=[@lib.field("kind", "file")])
|
|
ignore(logger.sink.flush())
|
|
ignore(logger.sink.close())
|
|
}
|