@logtape/fastify 1.3.0-dev.378 → 1.3.0-dev.379
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +81 -0
- package/deno.json +1 -1
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<!-- deno-fmt-ignore-file -->
|
|
2
|
+
|
|
3
|
+
@logtape/fastify
|
|
4
|
+
================
|
|
5
|
+
|
|
6
|
+
[![JSR][JSR badge]][JSR]
|
|
7
|
+
[![npm][npm badge]][npm]
|
|
8
|
+
|
|
9
|
+
*@logtape/fastify* is a [Pino]-compatible logger adapter that allows you to use
|
|
10
|
+
[LogTape] as [Fastify]'s logging backend. This enables seamless integration
|
|
11
|
+
between Fastify applications and LogTape's structured logging capabilities.
|
|
12
|
+
|
|
13
|
+
[JSR]: https://jsr.io/@logtape/fastify
|
|
14
|
+
[JSR badge]: https://jsr.io/badges/@logtape/fastify
|
|
15
|
+
[npm]: https://www.npmjs.com/package/@logtape/fastify
|
|
16
|
+
[npm badge]: https://img.shields.io/npm/v/@logtape/fastify?logo=npm
|
|
17
|
+
[LogTape]: https://logtape.org/
|
|
18
|
+
[Fastify]: https://fastify.dev/
|
|
19
|
+
[Pino]: https://getpino.io/
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
Installation
|
|
23
|
+
------------
|
|
24
|
+
|
|
25
|
+
~~~~ sh
|
|
26
|
+
deno add jsr:@logtape/fastify # for Deno
|
|
27
|
+
npm add @logtape/fastify # for npm
|
|
28
|
+
pnpm add @logtape/fastify # for pnpm
|
|
29
|
+
yarn add @logtape/fastify # for Yarn
|
|
30
|
+
bun add @logtape/fastify # for Bun
|
|
31
|
+
~~~~
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
Usage
|
|
35
|
+
-----
|
|
36
|
+
|
|
37
|
+
~~~~ typescript
|
|
38
|
+
import { configure, getConsoleSink } from "@logtape/logtape";
|
|
39
|
+
import { getLogTapeFastifyLogger } from "@logtape/fastify";
|
|
40
|
+
import Fastify from "fastify";
|
|
41
|
+
|
|
42
|
+
await configure({
|
|
43
|
+
sinks: { console: getConsoleSink() },
|
|
44
|
+
loggers: [
|
|
45
|
+
{ category: ["fastify"], sinks: ["console"], lowestLevel: "info" }
|
|
46
|
+
],
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const fastify = Fastify({
|
|
50
|
+
loggerInstance: getLogTapeFastifyLogger(),
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
fastify.get("/", async (request, reply) => {
|
|
54
|
+
request.log.info("Handling request");
|
|
55
|
+
return { hello: "world" };
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
await fastify.listen({ port: 3000 });
|
|
59
|
+
~~~~
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
Custom category
|
|
63
|
+
---------------
|
|
64
|
+
|
|
65
|
+
You can specify a custom category for the logger:
|
|
66
|
+
|
|
67
|
+
~~~~ typescript
|
|
68
|
+
const fastify = Fastify({
|
|
69
|
+
loggerInstance: getLogTapeFastifyLogger({
|
|
70
|
+
category: ["myapp", "http"],
|
|
71
|
+
}),
|
|
72
|
+
});
|
|
73
|
+
~~~~
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
Docs
|
|
77
|
+
----
|
|
78
|
+
|
|
79
|
+
The docs of this package is available at
|
|
80
|
+
<https://logtape.org/manual/integrations#fastify>.
|
|
81
|
+
For the API references, see <https://jsr.io/@logtape/fastify/doc>.
|
package/deno.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logtape/fastify",
|
|
3
|
-
"version": "1.3.0-dev.
|
|
3
|
+
"version": "1.3.0-dev.379+84654e7a",
|
|
4
4
|
"description": "Fastify adapter for LogTape logging library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"logging",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"sideEffects": false,
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"@logtape/logtape": "^1.3.0-dev.
|
|
49
|
+
"@logtape/logtape": "^1.3.0-dev.379+84654e7a"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@alinea/suite": "^0.6.3",
|