📝 align remaining async examples

This commit is contained in:
Nanaloveyuki
2026-06-14 00:14:19 +08:00
parent e035625fc1
commit 7440f1d328
3 changed files with 12 additions and 12 deletions
+4 -4
View File
@@ -2,8 +2,8 @@
name: async-logger-debug name: async-logger-debug
group: api group: api
category: async category: async
update-time: 20260512 update-time: 20260614
description: Enqueue a debug-level record through the async logger using the built-in severity shortcut. description: Enqueue a debug-level record through the async logger using the built-in severity shortcut and the repo's direct async call style.
key-word: key-word:
- async - async
- logger - logger
@@ -52,7 +52,7 @@ Here are some specific examples provided.
When intermediate async flow details should be visible during debugging: When intermediate async flow details should be visible during debugging:
```moonbit ```moonbit
await logger.debug("loaded worker config") logger.debug("loaded worker config")
``` ```
In this example, the call site communicates its intended diagnostic level directly. In this example, the call site communicates its intended diagnostic level directly.
@@ -61,7 +61,7 @@ In this example, the call site communicates its intended diagnostic level direct
When a debug event should include extra fields: When a debug event should include extra fields:
```moonbit ```moonbit
await logger.debug( logger.debug(
"dispatch start", "dispatch start",
fields=[@bitlogger.field("job_id", "42")], fields=[@bitlogger.field("job_id", "42")],
) )
+4 -4
View File
@@ -2,8 +2,8 @@
name: async-logger-trace name: async-logger-trace
group: api group: api
category: async category: async
update-time: 20260512 update-time: 20260614
description: Enqueue a trace-level record through the async logger using the lowest built-in severity shortcut. description: Enqueue a trace-level record through the async logger using the lowest built-in severity shortcut and the repo's direct async call style.
key-word: key-word:
- async - async
- logger - logger
@@ -52,7 +52,7 @@ Here are some specific examples provided.
When low-level execution flow should be observable during debugging: When low-level execution flow should be observable during debugging:
```moonbit ```moonbit
await logger.trace("entered reconciliation step") logger.trace("entered reconciliation step")
``` ```
In this example, the call site makes trace intent explicit. In this example, the call site makes trace intent explicit.
@@ -61,7 +61,7 @@ In this example, the call site makes trace intent explicit.
When a trace event should carry extra fields: When a trace event should carry extra fields:
```moonbit ```moonbit
await logger.trace( logger.trace(
"cache probe", "cache probe",
fields=[@bitlogger.field("key", "user:42")], fields=[@bitlogger.field("key", "user:42")],
) )
+4 -4
View File
@@ -2,8 +2,8 @@
name: library-async-logger-is-enabled name: library-async-logger-is-enabled
group: api group: api
category: facade category: facade
update-time: 20260613 update-time: 20260614
description: Check whether a LibraryAsyncLogger facade would accept a record at a given level. description: Check whether a LibraryAsyncLogger facade would accept a record at a given level before using the repo's direct async call style.
key-word: key-word:
- async - async
- library - library
@@ -51,7 +51,7 @@ Here are some specific examples provided.
When debug data should only be built if needed: When debug data should only be built if needed:
```moonbit ```moonbit
if logger.is_enabled(@bitlogger.Level::Info) { if logger.is_enabled(@bitlogger.Level::Info) {
await logger.info(build_summary()) logger.info(build_summary())
} }
``` ```
@@ -62,7 +62,7 @@ In this example, expensive preparation is skipped unless the current threshold a
When package code should branch based on current logger behavior: When package code should branch based on current logger behavior:
```moonbit ```moonbit
if logger.is_enabled(@bitlogger.Level::Warn) { if logger.is_enabled(@bitlogger.Level::Warn) {
await logger.warn("slow path active") logger.warn("slow path active")
} }
``` ```