Skip to content

Commit 7b215e9

Browse files
committed
logtape writer
1 parent fde31e6 commit 7b215e9

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

packages/web/docs/src/content/logger.mdx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,35 @@ $ LOG_JSON_PRETTY=1 node example.js
519519
Hive Logger includes some writers for common loggers of the JavaScript ecosystem with optional peer
520520
dependencies.
521521
522+
#### `LogTapeLogWriter`
523+
524+
Use the [`LogTape` logger library](https://logtape.org/) for writing Hive Logger's logs.
525+
526+
`@logtape/logtape` is an optional peer dependency, so you must install it first.
527+
528+
```sh npm2yarn
529+
npm i @logtape/logtape
530+
```
531+
532+
```ts
533+
import { Logger } from '@graphql-hive/logger'
534+
import { LogTapeLogWriter } from '@graphql-hive/logger/writers/logtape'
535+
import { configure, getConsoleSink } from '@logtape/logtape'
536+
537+
await configure({
538+
sinks: { console: getConsoleSink() },
539+
loggers: [{ category: 'hive-gateway', sinks: ['console'] }]
540+
})
541+
542+
const log = new Logger({ writers: [new LogTapeLogWriter()] })
543+
544+
log.info({ some: 'attributes' }, 'hello world')
545+
```
546+
547+
```sh
548+
14:00:00.000 INF hive-gateway hello world
549+
```
550+
522551
#### `PinoLogWriter` (Node.js Only)
523552
524553
Use the [Node.js `pino` logger library](https://github.com/pinojs/pino) for writing Hive Logger's

0 commit comments

Comments
 (0)