mirror of
https://github.com/Nanaloveyuki/BitLogger.git
synced 2026-07-31 07:24:31 +00:00
📝 align async lifecycle examples
This commit is contained in:
@@ -47,7 +47,7 @@ Here are some specific examples provided.
|
|||||||
|
|
||||||
When a service should stop logging only after queued records are drained:
|
When a service should stop logging only after queued records are drained:
|
||||||
```moonbit
|
```moonbit
|
||||||
await logger.shutdown()
|
logger.shutdown()
|
||||||
```
|
```
|
||||||
|
|
||||||
In this example, the logger waits for normal drain behavior before final closure.
|
In this example, the logger waits for normal drain behavior before final closure.
|
||||||
@@ -56,7 +56,7 @@ In this example, the logger waits for normal drain behavior before final closure
|
|||||||
|
|
||||||
When teardown should prefer speed over preserving backlog:
|
When teardown should prefer speed over preserving backlog:
|
||||||
```moonbit
|
```moonbit
|
||||||
await logger.shutdown(clear=true)
|
logger.shutdown(clear=true)
|
||||||
```
|
```
|
||||||
|
|
||||||
In this example, pending work is abandoned intentionally so shutdown can complete sooner.
|
In this example, pending work is abandoned intentionally so shutdown can complete sooner.
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
name: async-logger-wait-idle
|
name: async-logger-wait-idle
|
||||||
group: api
|
group: api
|
||||||
category: async
|
category: async
|
||||||
update-time: 20260512
|
update-time: 20260614
|
||||||
description: Wait until the async logger backlog drains to zero or a worker failure interrupts normal progress.
|
description: Wait until the async logger backlog drains to zero or a worker failure interrupts normal progress, using the repo's direct async call style.
|
||||||
key-word:
|
key-word:
|
||||||
- async
|
- async
|
||||||
- logger
|
- logger
|
||||||
@@ -46,7 +46,7 @@ Here are some specific examples provided.
|
|||||||
|
|
||||||
When code should wait for queued work to flush before continuing:
|
When code should wait for queued work to flush before continuing:
|
||||||
```moonbit
|
```moonbit
|
||||||
await logger.wait_idle()
|
logger.wait_idle()
|
||||||
```
|
```
|
||||||
|
|
||||||
In this example, the caller waits for backlog drain but leaves the logger usable afterward.
|
In this example, the caller waits for backlog drain but leaves the logger usable afterward.
|
||||||
@@ -55,7 +55,7 @@ In this example, the caller waits for backlog drain but leaves the logger usable
|
|||||||
|
|
||||||
When a test wants to ensure earlier async logs were processed:
|
When a test wants to ensure earlier async logs were processed:
|
||||||
```moonbit
|
```moonbit
|
||||||
await logger.wait_idle()
|
logger.wait_idle()
|
||||||
println("phase complete")
|
println("phase complete")
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ Here are some specific examples provided.
|
|||||||
|
|
||||||
When a service should stop logging only after queued records are drained:
|
When a service should stop logging only after queued records are drained:
|
||||||
```moonbit
|
```moonbit
|
||||||
await logger.shutdown()
|
logger.shutdown()
|
||||||
```
|
```
|
||||||
|
|
||||||
In this example, the facade waits for normal drain behavior before final closure.
|
In this example, the facade waits for normal drain behavior before final closure.
|
||||||
@@ -60,7 +60,7 @@ In this example, the facade waits for normal drain behavior before final closure
|
|||||||
|
|
||||||
When teardown should prefer speed over preserving backlog:
|
When teardown should prefer speed over preserving backlog:
|
||||||
```moonbit
|
```moonbit
|
||||||
await logger.shutdown(clear=true)
|
logger.shutdown(clear=true)
|
||||||
```
|
```
|
||||||
|
|
||||||
In this example, pending work is abandoned intentionally so shutdown can complete sooner.
|
In this example, pending work is abandoned intentionally so shutdown can complete sooner.
|
||||||
|
|||||||
Reference in New Issue
Block a user