@nexload-sdk/logger 4.0.1 → 5.0.0
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 +240 -34
- package/dist/config.d.ts +62 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/context.browser.d.ts +9 -0
- package/dist/context.browser.d.ts.map +1 -0
- package/dist/context.node.d.ts +6 -0
- package/dist/context.node.d.ts.map +1 -0
- package/dist/index.browser.d.ts +3 -0
- package/dist/index.browser.d.ts.map +1 -0
- package/dist/index.browser.mjs +1383 -0
- package/dist/index.browser.mjs.map +7 -0
- package/dist/index.cjs +236 -412
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +8 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +227 -409
- package/dist/index.mjs.map +4 -4
- package/dist/levels.d.ts +3 -0
- package/dist/levels.d.ts.map +1 -0
- package/dist/pretty.d.ts +4 -0
- package/dist/pretty.d.ts.map +1 -0
- package/dist/proxy.d.ts +3 -0
- package/dist/proxy.d.ts.map +1 -0
- package/dist/redact.d.ts +2 -0
- package/dist/redact.d.ts.map +1 -0
- package/dist/serialize-error.d.ts +2 -0
- package/dist/serialize-error.d.ts.map +1 -0
- package/dist/testing.cjs +206 -0
- package/dist/testing.cjs.map +7 -0
- package/dist/testing.d.ts +7 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.mjs +168 -0
- package/dist/testing.mjs.map +7 -0
- package/dist/trace.d.ts +6 -0
- package/dist/trace.d.ts.map +1 -0
- package/dist/types.d.ts +39 -16
- package/dist/types.d.ts.map +1 -1
- package/package.json +17 -11
- package/dist/log-test.cjs +0 -102
- package/dist/log-test.cjs.map +0 -7
- package/dist/log-test.d.ts +0 -3
- package/dist/log-test.d.ts.map +0 -1
- package/dist/log-test.mjs +0 -78
- package/dist/log-test.mjs.map +0 -7
- package/dist/logger.d.ts +0 -20
- package/dist/logger.d.ts.map +0 -1
- package/dist/renderers/browser-pretty.d.ts +0 -12
- package/dist/renderers/browser-pretty.d.ts.map +0 -1
- package/dist/renderers/browser-pure.d.ts +0 -3
- package/dist/renderers/browser-pure.d.ts.map +0 -1
- package/dist/renderers/node-pretty.d.ts +0 -12
- package/dist/renderers/node-pretty.d.ts.map +0 -1
- package/dist/renderers/node-pure-json.d.ts +0 -3
- package/dist/renderers/node-pure-json.d.ts.map +0 -1
- package/dist/utils/create-global.d.ts +0 -3
- package/dist/utils/create-global.d.ts.map +0 -1
- package/dist/utils/json-humanize.d.ts +0 -2
- package/dist/utils/json-humanize.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,64 +1,270 @@
|
|
|
1
1
|
# @nexload-sdk/logger
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Configure-once structured logging for Node.js, Bun, Edge, and browsers, built on Pino.**
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@nexload-sdk/logger)
|
|
6
|
+

|
|
7
|
+

|
|
8
|
+

|
|
9
|
+
|
|
10
|
+
> [!IMPORTANT]
|
|
11
|
+
> Version 5.0.0 is pending in `.changeset/`: log levels in structured output are lowercase (`LOG_LEVEL` accepts uppercase), `NexloadLogger`, custom renderers, and `./log-test` are removed, and `getPayloadLoggerConfig()` (with `PayloadLoggerConfig`) is added to bridge SDK options into Payload's logger.
|
|
12
|
+
|
|
13
|
+
## Table of contents
|
|
14
|
+
|
|
15
|
+
- [Overview](#overview)
|
|
16
|
+
- [Philosophy](#philosophy)
|
|
17
|
+
- [Install](#install)
|
|
18
|
+
- [Quick start](#quick-start)
|
|
19
|
+
- [Usage](#usage)
|
|
20
|
+
- [API](#api)
|
|
21
|
+
- [Configuration](#configuration)
|
|
22
|
+
- [Runtime and compatibility](#runtime-and-compatibility)
|
|
23
|
+
- [Caveats](#caveats)
|
|
24
|
+
- [Migration](#migration)
|
|
25
|
+
- [Related packages](#related-packages)
|
|
26
|
+
- [License](#license)
|
|
27
|
+
|
|
28
|
+
## Overview
|
|
29
|
+
|
|
30
|
+
`@nexload-sdk/logger` provides a single configure-once structured logger built on `pino` for server and client runtimes. It solves duplicated logger setup, inconsistent redaction, and broken `Error` serialization across Next.js, Node.js, Bun, and Payload CMS services. It is for application and package authors who want safe defaults, request-scoped context on Node/Bun, and isolated test capture.
|
|
31
|
+
|
|
32
|
+
What it is not:
|
|
33
|
+
|
|
34
|
+
- Not a log shipping agent or external transport collector (no Datadog, Loki, or OpenTelemetry transport built in).
|
|
35
|
+
- Not a distributed tracing SDK; it only propagates an `x-trace-id` header and AsyncLocalStorage bindings.
|
|
36
|
+
- Not an arbitrary-depth object scrubber; default redaction stops one level below the top-level log object.
|
|
37
|
+
|
|
38
|
+
## Philosophy
|
|
39
|
+
|
|
40
|
+
- **Configure once at startup:** A lazy proxy lets modules import `logger` at load time while binding to the runtime configuration set once by `configureLogger()`.
|
|
41
|
+
- **Safe defaults by default:** Sensitive keys (`password`, `token`, `secret`, `apiKey`, `authorization`, `cookie`, `otp`, `phone`, `mobile`, `merchant`), `Error` serialization, and ISO timestamps are enabled without boilerplate.
|
|
42
|
+
- **Identifiers over payloads:** Context propagation and child bindings carry `requestId`, `traceId`, and entity IDs rather than full request bodies or credentials.
|
|
43
|
+
- **Explicit runtime boundaries:** Conditional exports route `browser`, `edge-light`, and `worker` to a browser-safe build while keeping Node `AsyncLocalStorage` isolated on the server.
|
|
4
44
|
|
|
5
45
|
## Install
|
|
6
46
|
|
|
7
47
|
```bash
|
|
8
48
|
pnpm add @nexload-sdk/logger
|
|
49
|
+
# or
|
|
50
|
+
npm install @nexload-sdk/logger
|
|
51
|
+
# or
|
|
52
|
+
yarn add @nexload-sdk/logger
|
|
53
|
+
# or
|
|
54
|
+
bun add @nexload-sdk/logger
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
This package has no required or optional peer dependencies (`pino` is a direct dependency).
|
|
58
|
+
|
|
59
|
+
| Package | Range | Required / Optional |
|
|
60
|
+
| --- | --- | --- |
|
|
61
|
+
| *(none)* | — | No peer dependencies |
|
|
62
|
+
|
|
63
|
+
## Quick start
|
|
64
|
+
|
|
65
|
+
Configure logging once at your service entry point, then import the `logger` proxy anywhere:
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
import { configureLogger, logger } from "@nexload-sdk/logger";
|
|
69
|
+
|
|
70
|
+
configureLogger({ service: "shop-api", release: process.env.RELEASE });
|
|
71
|
+
|
|
72
|
+
const log = logger.child({ module: "orders" });
|
|
73
|
+
log.info({ event: "order.lifecycle.created", orderId: "123" }, "Order created");
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Usage
|
|
77
|
+
|
|
78
|
+
Before configuration, the lazy logger uses environment defaults; children follow later configuration, including forced replacements. The `SERVICE_NAME` / `"unknown"` fallback applies to the unconfigured lazy logger and `createTestLogger`. Base output includes `service`, optional release, instance and environment, `pid`, and ISO `time`.
|
|
79
|
+
|
|
80
|
+
### Next.js instrumentation
|
|
81
|
+
|
|
82
|
+
Register the logger in `instrumentation.ts` before handling requests:
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
export async function register() {
|
|
86
|
+
const { configureLogger } = await import("@nexload-sdk/logger");
|
|
87
|
+
configureLogger({ service: "shop-web", release: process.env.RELEASE });
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Payload CMS logger bridge
|
|
92
|
+
|
|
93
|
+
Call `configureLogger()` before `buildConfig()`, then pass `getPayloadLoggerConfig()` to `config.logger`:
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
import { configureLogger, getPayloadLoggerConfig } from "@nexload-sdk/logger";
|
|
97
|
+
import { buildConfig } from "payload";
|
|
98
|
+
|
|
99
|
+
configureLogger({ service: "cms" });
|
|
100
|
+
|
|
101
|
+
export default buildConfig({
|
|
102
|
+
logger: getPayloadLoggerConfig(),
|
|
103
|
+
});
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Payload creates its own Pino logger using the SDK's redaction, error serializer, request context mixin, base fields, ISO timestamps, level, and explicit `destination`.
|
|
107
|
+
|
|
108
|
+
### Log levels
|
|
109
|
+
|
|
110
|
+
| Level | Value | Use |
|
|
111
|
+
| --- | ---: | --- |
|
|
112
|
+
| `trace` | 10 | Very verbose diagnostics |
|
|
113
|
+
| `debug` | 20 | Diagnostics |
|
|
114
|
+
| `info` | 30 | Lifecycle and request summaries |
|
|
115
|
+
| `success` | 35 | Business milestones |
|
|
116
|
+
| `warn` | 40 | Handled degradation or retry |
|
|
117
|
+
| `error` | 50 | Unexpected failure needing attention |
|
|
118
|
+
| `fatal` | 60 | Process cannot continue |
|
|
119
|
+
|
|
120
|
+
Structured JSON uses lowercase level labels; the Node pretty stream displays them in uppercase.
|
|
121
|
+
|
|
122
|
+
Level methods accept an object, an `Error`, or a string message, followed by an optional message. Use `isLevelEnabled(level)` to guard expensive log construction.
|
|
123
|
+
|
|
124
|
+
### Redaction
|
|
125
|
+
|
|
126
|
+
By default, `DEFAULT_REDACT_PATHS` redacts `password`, `token`, `secret`, `apiKey`, `authorization`, `cookie`, `otp`, `phone`, `mobile`, and `merchant` at the top level and one level below it, plus `req.headers.authorization`, `req.headers.cookie`, `headers.authorization`, `headers.cookie`, `body`, and `req.body`, using `[REDACTED]` as the censor.
|
|
127
|
+
|
|
128
|
+
```ts
|
|
129
|
+
import { configureLogger } from "@nexload-sdk/logger";
|
|
130
|
+
|
|
131
|
+
configureLogger({
|
|
132
|
+
service: "shop-api",
|
|
133
|
+
redact: { paths: ["customer.nationalCode"] },
|
|
134
|
+
});
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Set `replaceDefaults: true` to replace `DEFAULT_REDACT_PATHS`, or `censor` to change the replacement string.
|
|
138
|
+
|
|
139
|
+
### Error serialization
|
|
140
|
+
|
|
141
|
+
Pass an `Error` under `err` or as the first argument:
|
|
142
|
+
|
|
143
|
+
```ts
|
|
144
|
+
import { logger } from "@nexload-sdk/logger";
|
|
145
|
+
|
|
146
|
+
try {
|
|
147
|
+
await performOperation();
|
|
148
|
+
} catch (err) {
|
|
149
|
+
logger.error({ err, event: "order.operation.failed" }, "Operation failed");
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
logger.error(new Error("Operation failed"));
|
|
9
153
|
```
|
|
10
154
|
|
|
11
|
-
|
|
155
|
+
The `err` serializer records the error type, a message capped at 500 characters, a `code` matching `/^[A-Z][A-Z0-9_]{1,99}$/`, and up to two nested causes (three error records total). Stack traces appear only outside production. Non-`Error` values become `{ type, message }`, using `typeof` and the string value capped at 500 characters.
|
|
12
156
|
|
|
13
|
-
|
|
14
|
-
- `NexloadLogger`
|
|
15
|
-
- logger types (`LogLevel`, renderer types, helpers)
|
|
16
|
-
- `test` helper from `@nexload-sdk/logger/log-test`
|
|
157
|
+
### Request context and trace IDs
|
|
17
158
|
|
|
18
|
-
|
|
159
|
+
On Node.js and Bun, `withLogContext` preserves bindings across async calls; nested calls merge with inner bindings taking precedence:
|
|
19
160
|
|
|
20
161
|
```ts
|
|
21
|
-
import
|
|
162
|
+
import {
|
|
163
|
+
logger,
|
|
164
|
+
resolveTraceId,
|
|
165
|
+
traceHeaders,
|
|
166
|
+
withLogContext,
|
|
167
|
+
} from "@nexload-sdk/logger";
|
|
22
168
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
169
|
+
export async function GET(req: Request) {
|
|
170
|
+
const traceId = resolveTraceId(req.headers);
|
|
171
|
+
return withLogContext({ requestId: traceId, traceId }, async () => {
|
|
172
|
+
logger.info({ event: "request.lifecycle.started" }, "Request started");
|
|
173
|
+
return fetch("https://example.com/api", { headers: traceHeaders() });
|
|
174
|
+
});
|
|
175
|
+
}
|
|
26
176
|
```
|
|
27
177
|
|
|
28
|
-
|
|
178
|
+
### Testing with `@nexload-sdk/logger/testing`
|
|
179
|
+
|
|
180
|
+
Use `createTestLogger` to capture parsed JSON log entries in isolation from the global logger:
|
|
29
181
|
|
|
30
182
|
```ts
|
|
31
|
-
|
|
32
|
-
|
|
183
|
+
import { createTestLogger } from "@nexload-sdk/logger/testing";
|
|
184
|
+
|
|
185
|
+
const { logger, entries, clear } = createTestLogger({ service: "test" });
|
|
186
|
+
logger.info({ orderId: "123" }, "Created");
|
|
187
|
+
// entries[0] -> { level: "info", service: "test", orderId: "123", msg: "Created", ... }
|
|
188
|
+
clear();
|
|
33
189
|
```
|
|
34
190
|
|
|
35
191
|
## API
|
|
36
192
|
|
|
37
|
-
### `
|
|
193
|
+
### Root entry (`@nexload-sdk/logger`)
|
|
194
|
+
|
|
195
|
+
| Export | Kind | Summary |
|
|
196
|
+
| --- | --- | --- |
|
|
197
|
+
| `logger` | `const` | Lazy `Logger` proxy (also exported as `default`) |
|
|
198
|
+
| `configureLogger` | `function` | Configures the global logger once and returns the proxy |
|
|
199
|
+
| `getPayloadLoggerConfig` | `function` | Returns `PayloadLoggerConfig` for Payload's `config.logger` |
|
|
200
|
+
| `withLogContext` | `function` | Runs a callback with `AsyncLocalStorage` bindings (pass-through on Edge/browser) |
|
|
201
|
+
| `getLogContext` | `function` | Returns current context bindings (`{}` on Edge/browser) |
|
|
202
|
+
| `DEFAULT_REDACT_PATHS` | `const` | Default Pino redaction paths |
|
|
203
|
+
| `TRACE_HEADER` | `const` | Trace header name (`"x-trace-id"`) |
|
|
204
|
+
| `resolveTraceId` | `function` | Reuses a valid `x-trace-id` (8–64 characters of `[A-Za-z0-9-]`) from `Headers` or a string record; otherwise generates a UUID |
|
|
205
|
+
| `traceHeaders` | `function` | Returns `{ "x-trace-id": traceId }` when active, otherwise `{}` |
|
|
206
|
+
| `PayloadLoggerConfig` | `type` | Return shape of `getPayloadLoggerConfig()` |
|
|
207
|
+
| `Logger` | `type` | Logger interface (`trace`..`fatal`, `child`, `isLevelEnabled`) |
|
|
208
|
+
| `LoggerOptions` | `type` | Configuration options accepted by `configureLogger` |
|
|
209
|
+
| `LogLevel` | `type` | Union of supported level names |
|
|
210
|
+
| `LogBindings` | `type` | Record of structured context bindings |
|
|
211
|
+
| `LogEntry` | `type` | Parsed JSON log record shape |
|
|
212
|
+
|
|
213
|
+
### Testing subpath (`@nexload-sdk/logger/testing`)
|
|
214
|
+
|
|
215
|
+
| Export | Kind | Summary |
|
|
216
|
+
| --- | --- | --- |
|
|
217
|
+
| `createTestLogger` | `function` | Creates an isolated `{ logger, entries, clear }` test harness |
|
|
218
|
+
|
|
219
|
+
## Configuration
|
|
220
|
+
|
|
221
|
+
| Option | Type | Default | Description |
|
|
222
|
+
| --- | --- | --- | --- |
|
|
223
|
+
| `service` | `string` | Required | Service name included in `base` fields |
|
|
224
|
+
| `level` | `LogLevel` | `LOG_LEVEL`, else `"info"` (prod) / `"debug"` | Minimum log threshold |
|
|
225
|
+
| `release` | `string` | `process.env.RELEASE` | Optional release identifier |
|
|
226
|
+
| `instance` | `string` | `undefined` | Optional instance identifier |
|
|
227
|
+
| `environment` | `string` | `undefined` | Optional environment label |
|
|
228
|
+
| `redact` | `{ paths?: string[]; replaceDefaults?: boolean; censor?: string }` | `DEFAULT_REDACT_PATHS`, `"[REDACTED]"` | Redaction paths and replacement censor |
|
|
229
|
+
| `pretty` | `boolean` | `NODE_ENV !== "production"` | Enables pretty output on Node when no `destination` is set |
|
|
230
|
+
| `destination` | `{ write(line: string): void }` | `undefined` | Custom output stream; overrides `pretty` |
|
|
231
|
+
| `base` | `Record<string, string \| number \| boolean>` | `undefined` | Extra base fields merged into every record |
|
|
232
|
+
| `force` | `boolean` | `false` | Replaces an existing configuration when `true` |
|
|
233
|
+
|
|
234
|
+
## Runtime and compatibility
|
|
235
|
+
|
|
236
|
+
- **Module format:** Dual ESM (`import`) and CJS (`require`) via conditional `exports`.
|
|
237
|
+
- **Node.js and Bun:** Full support, including `AsyncLocalStorage` request context, pretty stream, and `destination`.
|
|
238
|
+
- **Edge and Browser:** Selected automatically via `browser`, `edge-light`, and `worker` export conditions. Uses Pino browser object output; `pretty` and `destination` do not configure a server stream, `withLogContext` is pass-through, and `getLogContext()` returns `{}`.
|
|
239
|
+
- **Testing subpath (`./testing`):** Node ESM and CJS only.
|
|
240
|
+
- **Environment fallbacks:** Reads `SERVICE_NAME`, `LOG_LEVEL` (case-insensitive), `RELEASE`, and `NODE_ENV`.
|
|
241
|
+
|
|
242
|
+
## Caveats
|
|
243
|
+
|
|
244
|
+
> [!WARNING]
|
|
245
|
+
> Default redaction only matches keys at the top level and one level deep. A nested key two levels deep, such as `user.profile.phone`, is **not** redacted unless you add an explicit path.
|
|
246
|
+
|
|
247
|
+
> [!WARNING]
|
|
248
|
+
> Calling `configureLogger()` a second time without `force: true` logs a warning (`event: "logger.reconfigure.ignored"`) and returns the existing proxy. With `getPayloadLoggerConfig()`, you must rebuild Payload's config to pick up a forced reconfiguration.
|
|
38
249
|
|
|
39
|
-
|
|
250
|
+
> [!NOTE]
|
|
251
|
+
> `getPayloadLoggerConfig()` maps the SDK's `success` threshold (`35`) to `warn` (`40`)—the next standard Pino level—because Payload's logger uses standard Pino levels. Without an explicit `destination`, Payload writes JSON to its default stream.
|
|
40
252
|
|
|
41
|
-
|
|
42
|
-
- `debug(obj, msg?)`
|
|
43
|
-
- `info(obj, msg?)`
|
|
44
|
-
- `success(obj, msg?)`
|
|
45
|
-
- `warn(obj, msg?)`
|
|
46
|
-
- `error(obj, msg?)`
|
|
47
|
-
- `fatal(obj, msg?)`
|
|
48
|
-
- `child(obj)`
|
|
253
|
+
## Migration
|
|
49
254
|
|
|
50
|
-
|
|
255
|
+
### From v4 to v5
|
|
51
256
|
|
|
52
|
-
|
|
257
|
+
- Replace `NexloadLogger` and `createGlobalLogger` with `configureLogger` and the `logger` proxy; pass object bindings to `child()`.
|
|
258
|
+
- Replace the removed `@nexload-sdk/logger/log-test` subpath with `createTestLogger` from `@nexload-sdk/logger/testing`.
|
|
259
|
+
- Remove custom renderer APIs; use `pretty` or `destination` instead.
|
|
260
|
+
- Expect lowercase level labels in structured JSON output (`LOG_LEVEL` still accepts uppercase values).
|
|
261
|
+
- Pass errors under `err` or as the first argument to log methods.
|
|
53
262
|
|
|
54
|
-
|
|
55
|
-
- `LOG_LEVEL` (or `$LOG_LEVEL`)
|
|
56
|
-
- `NODE_ENV`
|
|
57
|
-
- `DEBUG`
|
|
263
|
+
## Related packages
|
|
58
264
|
|
|
59
|
-
|
|
265
|
+
- [payload-hooks](../payload-hooks/README.md) — Payload collection audit logging built on `@nexload-sdk/logger`
|
|
266
|
+
- [payload-preset](../payload-preset/README.md) — Composed Payload preset that bridges `@nexload-sdk/logger` into `config.logger`
|
|
60
267
|
|
|
61
|
-
##
|
|
268
|
+
## License
|
|
62
269
|
|
|
63
|
-
|
|
64
|
-
- This is a custom logger implementation (not `pino`).
|
|
270
|
+
MIT
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import pino from "pino";
|
|
2
|
+
import type { Logger, LoggerOptions, LogLevel } from "./types";
|
|
3
|
+
import { getLogContext } from "./context.node";
|
|
4
|
+
import { serializeError } from "./serialize-error";
|
|
5
|
+
type PinoLogger = pino.Logger<"success">;
|
|
6
|
+
export type PayloadLoggerConfig = {
|
|
7
|
+
options: ReturnType<typeof buildPinoOptions>;
|
|
8
|
+
destination?: LoggerOptions["destination"];
|
|
9
|
+
};
|
|
10
|
+
declare function buildPinoOptions(options: Partial<LoggerOptions>): {
|
|
11
|
+
redact: {
|
|
12
|
+
paths: string[];
|
|
13
|
+
censor: string;
|
|
14
|
+
};
|
|
15
|
+
serializers: {
|
|
16
|
+
err: typeof serializeError;
|
|
17
|
+
};
|
|
18
|
+
mixin: typeof getLogContext;
|
|
19
|
+
level: LogLevel;
|
|
20
|
+
base: {
|
|
21
|
+
service: string;
|
|
22
|
+
release: string | undefined;
|
|
23
|
+
instance: string | undefined;
|
|
24
|
+
environment: string | undefined;
|
|
25
|
+
pid: number;
|
|
26
|
+
};
|
|
27
|
+
timestamp: () => string;
|
|
28
|
+
formatters: {
|
|
29
|
+
level: (label: string) => {
|
|
30
|
+
level: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export declare function createPinoLogger(options: Partial<LoggerOptions>, sharedOptions?: {
|
|
35
|
+
redact: {
|
|
36
|
+
paths: string[];
|
|
37
|
+
censor: string;
|
|
38
|
+
};
|
|
39
|
+
serializers: {
|
|
40
|
+
err: typeof serializeError;
|
|
41
|
+
};
|
|
42
|
+
mixin: typeof getLogContext;
|
|
43
|
+
level: LogLevel;
|
|
44
|
+
base: {
|
|
45
|
+
service: string;
|
|
46
|
+
release: string | undefined;
|
|
47
|
+
instance: string | undefined;
|
|
48
|
+
environment: string | undefined;
|
|
49
|
+
pid: number;
|
|
50
|
+
};
|
|
51
|
+
timestamp: () => string;
|
|
52
|
+
formatters: {
|
|
53
|
+
level: (label: string) => {
|
|
54
|
+
level: string;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
}): PinoLogger;
|
|
58
|
+
export declare function configureLogger(options: LoggerOptions): Logger;
|
|
59
|
+
export declare function getActiveLogger(): PinoLogger;
|
|
60
|
+
export declare function getPayloadLoggerConfig(): PayloadLoggerConfig;
|
|
61
|
+
export {};
|
|
62
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE/D,OAAO,EAAE,aAAa,EAAa,MAAM,gBAAgB,CAAC;AAK1D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,KAAK,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AAEzC,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;IAC7C,WAAW,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;CAC5C,CAAC;AAoBF,iBAAS,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC;;;;;;;;;;;;;;;;;;;;;;;EAiBxD;AAED,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,EAC/B,aAAa;;;;;;;;;;;;;;;;;;;;;;;CAA4B,GACxC,UAAU,CA2BZ;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAoB9D;AAED,wBAAgB,eAAe,IAAI,UAAU,CAE5C;AAED,wBAAgB,sBAAsB,IAAI,mBAAmB,CAgB5D"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { LogBindings } from "./types";
|
|
2
|
+
export declare const isBrowser = true;
|
|
3
|
+
export declare const browserProcess: NodeJS.Process | {
|
|
4
|
+
env: {};
|
|
5
|
+
};
|
|
6
|
+
export declare function withLogContext<T>(_bindings: LogBindings, fn: () => T): T;
|
|
7
|
+
export declare function getLogContext(): LogBindings;
|
|
8
|
+
export declare function newTraceId(): string;
|
|
9
|
+
//# sourceMappingURL=context.browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.browser.d.ts","sourceRoot":"","sources":["../src/context.browser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,eAAO,MAAM,SAAS,OAAO,CAAC;AAI9B,eAAO,MAAM,cAAc;;CAAiC,CAAC;AAE7D,wBAAgB,cAAc,CAAC,CAAC,EAAE,SAAS,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAExE;AAED,wBAAgB,aAAa,IAAI,WAAW,CAE3C;AAED,wBAAgB,UAAU,IAAI,MAAM,CAEnC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { LogBindings } from "./types";
|
|
2
|
+
export { randomUUID as newTraceId } from "node:crypto";
|
|
3
|
+
export declare const isBrowser: boolean;
|
|
4
|
+
export declare function withLogContext<T>(bindings: LogBindings, fn: () => T): T;
|
|
5
|
+
export declare function getLogContext(): LogBindings;
|
|
6
|
+
//# sourceMappingURL=context.node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.node.d.ts","sourceRoot":"","sources":["../src/context.node.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,EAAE,UAAU,IAAI,UAAU,EAAE,MAAM,aAAa,CAAC;AACvD,eAAO,MAAM,SAAS,EAAE,OAAe,CAAC;AASxC,wBAAgB,cAAc,CAAC,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAEvE;AAED,wBAAgB,aAAa,IAAI,WAAW,CAG3C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../src/index.browser.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC"}
|