mirror of
https://github.com/Nanaloveyuki/BitLogger.git
synced 2026-07-24 00:42:18 +00:00
🔊 Update 1.0.0
This commit is contained in:
@@ -1,6 +1,14 @@
|
||||
///|
|
||||
async fn main {
|
||||
println("examples/async_basic is shipped as a native-only example because async fn main entry support is still limited on non-native targets, even though src-async itself keeps compatibility behavior.")
|
||||
println(@lib_async.stringify_async_runtime_state(@lib_async.async_runtime_state(), pretty=true))
|
||||
println(
|
||||
"examples/async_basic is shipped as a native-only example because async fn main entry support is still limited on non-native targets, even though src-async itself keeps compatibility behavior.",
|
||||
)
|
||||
println(
|
||||
@lib_async.stringify_async_runtime_state(
|
||||
@lib_async.async_runtime_state(),
|
||||
pretty=true,
|
||||
),
|
||||
)
|
||||
|
||||
let raw = "{\"logger\":{\"min_level\":\"info\",\"target\":\"async.demo\",\"timestamp\":true,\"sink\":{\"kind\":\"text_console\",\"text_formatter\":{\"show_timestamp\":false,\"separator\":\" | \"}}},\"async_config\":{\"max_pending\":2,\"overflow\":\"DropOldest\",\"max_batch\":4,\"linger_ms\":5,\"flush\":\"Batch\"}}"
|
||||
let config = @lib_async.parse_async_logger_build_config_text(raw) catch {
|
||||
@@ -14,10 +22,12 @@ async fn main {
|
||||
let logger = @lib_async.build_async_logger(config)
|
||||
.with_context_fields([@lib.field("service", "bitlogger")])
|
||||
.with_filter(@lib.target_has_prefix("async"))
|
||||
.with_patch(@lib.compose_patches([
|
||||
@lib.prefix_message("[async] "),
|
||||
@lib.redact_fields(["token"]),
|
||||
]))
|
||||
.with_patch(
|
||||
@lib.compose_patches([
|
||||
@lib.prefix_message("[async] "),
|
||||
@lib.redact_fields(["token"]),
|
||||
]),
|
||||
)
|
||||
|
||||
println(@lib_async.stringify_async_logger_state(logger.state(), pretty=true))
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
"Nanaloveyuki/BitLogger/src" @lib,
|
||||
"Nanaloveyuki/BitLogger/src-async" @lib_async,
|
||||
"moonbitlang/async" @async,
|
||||
"moonbitlang/async",
|
||||
}
|
||||
|
||||
supported_targets = "+native"
|
||||
|
||||
Reference in New Issue
Block a user