mirror of
https://github.com/Nanaloveyuki/BitLogger.git
synced 2026-07-30 23:14:22 +00:00
📝 align async write examples
This commit is contained in:
@@ -2,8 +2,8 @@
|
|||||||
name: async-logger-error
|
name: async-logger-error
|
||||||
group: api
|
group: api
|
||||||
category: async
|
category: async
|
||||||
update-time: 20260512
|
update-time: 20260614
|
||||||
description: Enqueue an error-level record through the async logger using the highest built-in severity shortcut.
|
description: Enqueue an error-level record through the async logger using the highest 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 an operation should emit a high-severity failure event:
|
When an operation should emit a high-severity failure event:
|
||||||
```moonbit
|
```moonbit
|
||||||
await logger.error("worker execution failed")
|
logger.error("worker execution failed")
|
||||||
```
|
```
|
||||||
|
|
||||||
In this example, failure intent is explicit at the call site.
|
In this example, failure intent is explicit at the call site.
|
||||||
@@ -61,7 +61,7 @@ In this example, failure intent is explicit at the call site.
|
|||||||
|
|
||||||
When an error event should include diagnostic fields:
|
When an error event should include diagnostic fields:
|
||||||
```moonbit
|
```moonbit
|
||||||
await logger.error(
|
logger.error(
|
||||||
"dispatch failed",
|
"dispatch failed",
|
||||||
fields=[@bitlogger.field("job_id", "42")],
|
fields=[@bitlogger.field("job_id", "42")],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
name: async-logger-info
|
name: async-logger-info
|
||||||
group: api
|
group: api
|
||||||
category: async
|
category: async
|
||||||
update-time: 20260512
|
update-time: 20260614
|
||||||
description: Enqueue an info-level record through the async logger using the most common built-in severity shortcut.
|
description: Enqueue an info-level record through the async logger using the most common 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 async code should report routine progress or lifecycle events:
|
When async code should report routine progress or lifecycle events:
|
||||||
```moonbit
|
```moonbit
|
||||||
await logger.info("worker started")
|
logger.info("worker started")
|
||||||
```
|
```
|
||||||
|
|
||||||
In this example, the event is expressed at the most common operational logging level.
|
In this example, the event is expressed at the most common operational logging level.
|
||||||
@@ -61,7 +61,7 @@ In this example, the event is expressed at the most common operational logging l
|
|||||||
|
|
||||||
When an info event should include stable structured detail:
|
When an info event should include stable structured detail:
|
||||||
```moonbit
|
```moonbit
|
||||||
await logger.info(
|
logger.info(
|
||||||
"job queued",
|
"job queued",
|
||||||
fields=[@bitlogger.field("queue", "sync")],
|
fields=[@bitlogger.field("queue", "sync")],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
name: async-logger-log
|
name: async-logger-log
|
||||||
group: api
|
group: api
|
||||||
category: async
|
category: async
|
||||||
update-time: 20260512
|
update-time: 20260614
|
||||||
description: Enqueue a record into the async logger with an explicit level, message, optional fields, and optional target override.
|
description: Enqueue a record into the async logger with an explicit level, message, optional fields, and optional target override, using the repo's direct async call style.
|
||||||
key-word:
|
key-word:
|
||||||
- async
|
- async
|
||||||
- logger
|
- logger
|
||||||
@@ -56,7 +56,7 @@ Here are some specific examples provided.
|
|||||||
|
|
||||||
When code should choose level, fields, and target per event:
|
When code should choose level, fields, and target per event:
|
||||||
```moonbit
|
```moonbit
|
||||||
await logger.log(
|
logger.log(
|
||||||
@bitlogger.Level::Info,
|
@bitlogger.Level::Info,
|
||||||
"worker started",
|
"worker started",
|
||||||
fields=[@bitlogger.field("job", "sync")],
|
fields=[@bitlogger.field("job", "sync")],
|
||||||
@@ -70,7 +70,7 @@ In this example, all per-record inputs are supplied explicitly.
|
|||||||
|
|
||||||
When application code wants a custom wrapper around the base API:
|
When application code wants a custom wrapper around the base API:
|
||||||
```moonbit
|
```moonbit
|
||||||
await logger.log(@bitlogger.Level::Warn, "slow request")
|
logger.log(@bitlogger.Level::Warn, "slow request")
|
||||||
```
|
```
|
||||||
|
|
||||||
In this example, `log(...)` acts as the common primitive under custom wrappers or convenience methods.
|
In this example, `log(...)` acts as the common primitive under custom wrappers or convenience methods.
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
name: async-logger-warn
|
name: async-logger-warn
|
||||||
group: api
|
group: api
|
||||||
category: async
|
category: async
|
||||||
update-time: 20260512
|
update-time: 20260614
|
||||||
description: Enqueue a warning-level record through the async logger using the built-in severity shortcut.
|
description: Enqueue a warning-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 the system should report a non-fatal problem:
|
When the system should report a non-fatal problem:
|
||||||
```moonbit
|
```moonbit
|
||||||
await logger.warn("retry budget running low")
|
logger.warn("retry budget running low")
|
||||||
```
|
```
|
||||||
|
|
||||||
In this example, the event is surfaced at warning severity without using the generic `log(...)` form.
|
In this example, the event is surfaced at warning severity without using the generic `log(...)` form.
|
||||||
@@ -61,7 +61,7 @@ In this example, the event is surfaced at warning severity without using the gen
|
|||||||
|
|
||||||
When a warning event should include context:
|
When a warning event should include context:
|
||||||
```moonbit
|
```moonbit
|
||||||
await logger.warn(
|
logger.warn(
|
||||||
"queue near capacity",
|
"queue near capacity",
|
||||||
fields=[@bitlogger.field("pending", logger.pending_count().to_string())],
|
fields=[@bitlogger.field("pending", logger.pending_count().to_string())],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
name: library-async-logger-error
|
name: library-async-logger-error
|
||||||
group: api
|
group: api
|
||||||
category: facade
|
category: facade
|
||||||
update-time: 20260613
|
update-time: 20260614
|
||||||
description: Enqueue an error-level record through a LibraryAsyncLogger facade using the highest built-in severity shortcut.
|
description: Enqueue an error-level record through a LibraryAsyncLogger facade using the highest built-in severity shortcut and the repo's direct async call style.
|
||||||
key-word:
|
key-word:
|
||||||
- async
|
- async
|
||||||
- library
|
- library
|
||||||
@@ -52,7 +52,7 @@ Here are some specific examples provided.
|
|||||||
|
|
||||||
When an operation should emit a high-severity failure event:
|
When an operation should emit a high-severity failure event:
|
||||||
```moonbit
|
```moonbit
|
||||||
await logger.error("worker execution failed")
|
logger.error("worker execution failed")
|
||||||
```
|
```
|
||||||
|
|
||||||
In this example, failure intent is explicit at the call site.
|
In this example, failure intent is explicit at the call site.
|
||||||
@@ -61,7 +61,7 @@ In this example, failure intent is explicit at the call site.
|
|||||||
|
|
||||||
When an error event should include diagnostic fields:
|
When an error event should include diagnostic fields:
|
||||||
```moonbit
|
```moonbit
|
||||||
await logger.error(
|
logger.error(
|
||||||
"dispatch failed",
|
"dispatch failed",
|
||||||
fields=[@bitlogger.field("job_id", "42")],
|
fields=[@bitlogger.field("job_id", "42")],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
name: library-async-logger-info
|
name: library-async-logger-info
|
||||||
group: api
|
group: api
|
||||||
category: facade
|
category: facade
|
||||||
update-time: 20260613
|
update-time: 20260614
|
||||||
description: Enqueue an info-level record through a LibraryAsyncLogger facade using the informational severity shortcut.
|
description: Enqueue an info-level record through a LibraryAsyncLogger facade using the informational severity shortcut and the repo's direct async call style.
|
||||||
key-word:
|
key-word:
|
||||||
- async
|
- async
|
||||||
- library
|
- library
|
||||||
@@ -52,7 +52,7 @@ Here are some specific examples provided.
|
|||||||
|
|
||||||
When async package code should report routine progress or lifecycle events:
|
When async package code should report routine progress or lifecycle events:
|
||||||
```moonbit
|
```moonbit
|
||||||
await logger.info("worker started")
|
logger.info("worker started")
|
||||||
```
|
```
|
||||||
|
|
||||||
In this example, the event is expressed at the common operational logging level through the narrower facade.
|
In this example, the event is expressed at the common operational logging level through the narrower facade.
|
||||||
@@ -61,7 +61,7 @@ In this example, the event is expressed at the common operational logging level
|
|||||||
|
|
||||||
When an info event should include stable structured detail:
|
When an info event should include stable structured detail:
|
||||||
```moonbit
|
```moonbit
|
||||||
await logger.info(
|
logger.info(
|
||||||
"job queued",
|
"job queued",
|
||||||
fields=[@bitlogger.field("queue", "sync")],
|
fields=[@bitlogger.field("queue", "sync")],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
name: library-async-logger-log
|
name: library-async-logger-log
|
||||||
group: api
|
group: api
|
||||||
category: facade
|
category: facade
|
||||||
update-time: 20260613
|
update-time: 20260614
|
||||||
description: Enqueue a record through a LibraryAsyncLogger facade with explicit level, message, fields, and optional target override.
|
description: Enqueue a record through a LibraryAsyncLogger facade with explicit level, message, fields, and optional target override, using the repo's direct async call style.
|
||||||
key-word:
|
key-word:
|
||||||
- async
|
- async
|
||||||
- library
|
- library
|
||||||
@@ -56,7 +56,7 @@ Here are some specific examples provided.
|
|||||||
|
|
||||||
When library code should choose level, fields, and target per event:
|
When library code should choose level, fields, and target per event:
|
||||||
```moonbit
|
```moonbit
|
||||||
await logger.log(
|
logger.log(
|
||||||
@bitlogger.Level::Info,
|
@bitlogger.Level::Info,
|
||||||
"worker started",
|
"worker started",
|
||||||
fields=[@bitlogger.field("job", "sync")],
|
fields=[@bitlogger.field("job", "sync")],
|
||||||
@@ -70,7 +70,7 @@ In this example, the call site controls every major record property while keepin
|
|||||||
|
|
||||||
When package code defines its own logging helpers:
|
When package code defines its own logging helpers:
|
||||||
```moonbit
|
```moonbit
|
||||||
await logger.log(@bitlogger.Level::Warn, "slow request")
|
logger.log(@bitlogger.Level::Warn, "slow request")
|
||||||
```
|
```
|
||||||
|
|
||||||
In this example, `log(...)` acts as the shared primitive under custom library-facing wrappers.
|
In this example, `log(...)` acts as the shared primitive under custom library-facing wrappers.
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
name: library-async-logger-warn
|
name: library-async-logger-warn
|
||||||
group: api
|
group: api
|
||||||
category: facade
|
category: facade
|
||||||
update-time: 20260613
|
update-time: 20260614
|
||||||
description: Enqueue a warning-level record through a LibraryAsyncLogger facade using the built-in severity shortcut.
|
description: Enqueue a warning-level record through a LibraryAsyncLogger facade using the built-in severity shortcut and the repo's direct async call style.
|
||||||
key-word:
|
key-word:
|
||||||
- async
|
- async
|
||||||
- library
|
- library
|
||||||
@@ -52,7 +52,7 @@ Here are some specific examples provided.
|
|||||||
|
|
||||||
When the system should report a non-fatal problem:
|
When the system should report a non-fatal problem:
|
||||||
```moonbit
|
```moonbit
|
||||||
await logger.warn("retry budget running low")
|
logger.warn("retry budget running low")
|
||||||
```
|
```
|
||||||
|
|
||||||
In this example, the event is surfaced at warning severity without using the generic `log(...)` form.
|
In this example, the event is surfaced at warning severity without using the generic `log(...)` form.
|
||||||
@@ -61,7 +61,7 @@ In this example, the event is surfaced at warning severity without using the gen
|
|||||||
|
|
||||||
When a warning event should include context:
|
When a warning event should include context:
|
||||||
```moonbit
|
```moonbit
|
||||||
await logger.warn(
|
logger.warn(
|
||||||
"queue near capacity",
|
"queue near capacity",
|
||||||
fields=[@bitlogger.field("pending", "64")],
|
fields=[@bitlogger.field("pending", "64")],
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user