mirror of
https://github.com/kevinthedang/discord-ollama.git
synced 2026-11-08 10:51:18 -05:00
pass root logger, don't init new ones
This commit is contained in:
@@ -31,12 +31,15 @@ entry. Set `LOG_LEVEL` to configure the minimum level (defaults to `info`).
|
||||
```ts
|
||||
import { createLogger } from './components/index.js'
|
||||
|
||||
const logger = createLogger({ component: 'client' })
|
||||
logger.info({ username }, 'Client started')
|
||||
const logger = createLogger({ component: 'request', requestId })
|
||||
logger.info('Request started')
|
||||
```
|
||||
|
||||
Log entries are JSON and include the structured fields provided to the log
|
||||
method, along with `component` and (outside production) `caller`.
|
||||
method, along with `component` and (outside production) `caller`. The root Pino
|
||||
instance is shared; create one child when entering a context, then pass that
|
||||
same child logger through the context's work. Create another child only when
|
||||
you need to add more scoped bindings; child creation does not mutate its parent.
|
||||
|
||||
## Environment Setup
|
||||
* Clone this repo using `git clone https://github.com/kevinthedang/discord-ollama.git` or just use [GitHub Desktop](https://desktop.github.com/) to clone the repo.
|
||||
|
||||
Reference in New Issue
Block a user