@unhingged/logit 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +132 -2
- package/dist/chunk-3FU7DTQE.cjs +2117 -0
- package/dist/chunk-3FU7DTQE.cjs.map +1 -0
- package/dist/chunk-7J27DQIR.js +72 -0
- package/dist/chunk-7J27DQIR.js.map +1 -0
- package/dist/chunk-GW7WQELF.js +2117 -0
- package/dist/chunk-GW7WQELF.js.map +1 -0
- package/dist/chunk-SKS54NHB.cjs +72 -0
- package/dist/chunk-SKS54NHB.cjs.map +1 -0
- package/dist/express.cjs +195 -0
- package/dist/express.cjs.map +1 -0
- package/dist/express.d.cts +39 -0
- package/dist/express.d.ts +39 -0
- package/dist/express.js +195 -0
- package/dist/express.js.map +1 -0
- package/dist/index.cjs +143 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +877 -0
- package/dist/index.d.ts +877 -0
- package/dist/index.js +143 -0
- package/dist/index.js.map +1 -0
- package/dist/next.cjs +212 -0
- package/dist/next.cjs.map +1 -0
- package/dist/next.d.cts +55 -0
- package/dist/next.d.ts +55 -0
- package/dist/next.js +212 -0
- package/dist/next.js.map +1 -0
- package/dist/node.cjs +341 -0
- package/dist/node.cjs.map +1 -0
- package/dist/node.d.cts +58 -0
- package/dist/node.d.ts +58 -0
- package/dist/node.js +341 -0
- package/dist/node.js.map +1 -0
- package/dist/otel.cjs +304 -0
- package/dist/otel.cjs.map +1 -0
- package/dist/otel.d.cts +103 -0
- package/dist/otel.d.ts +103 -0
- package/dist/otel.js +304 -0
- package/dist/otel.js.map +1 -0
- package/dist/request-7cW3twuF.d.ts +34 -0
- package/dist/request-DrVrbDze.d.cts +34 -0
- package/package.json +89 -4
package/dist/express.cjs
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkSKS54NHBcjs = require('./chunk-SKS54NHB.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
var _chunk3FU7DTQEcjs = require('./chunk-3FU7DTQE.cjs');
|
|
76
|
+
|
|
77
|
+
// src/express.ts
|
|
78
|
+
var _async_hooks = require('async_hooks');
|
|
79
|
+
if (!_chunk3FU7DTQEcjs.LogContext.isAsync) _chunk3FU7DTQEcjs.LogContext.use(new (0, _async_hooks.AsyncLocalStorage)());
|
|
80
|
+
function requestLogger(options = {}) {
|
|
81
|
+
const logger = _nullishCoalesce(options.logger, () => ( _chunk3FU7DTQEcjs.log));
|
|
82
|
+
const responseHeader = _nullishCoalesce(options.responseHeader, () => ( "x-request-id"));
|
|
83
|
+
const stripQuery = _nullishCoalesce(options.stripQuery, () => ( true));
|
|
84
|
+
return (req, res, next) => {
|
|
85
|
+
const rawPath = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(req.originalUrl, () => ( req.url)), () => ( req.path)), () => ( "/"));
|
|
86
|
+
const path = stripQuery ? rawPath.split("?")[0] : rawPath;
|
|
87
|
+
const info = { method: _nullishCoalesce(req.method, () => ( "GET")), path, url: rawPath, headers: req.headers };
|
|
88
|
+
if (_optionalChain([options, 'access', _ => _.ignore, 'optionalCall', _2 => _2(info)])) {
|
|
89
|
+
next();
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
_chunkSKS54NHBcjs.runRequestScope.call(void 0, info, options, logger, (scope) => {
|
|
93
|
+
req.log = logger.forContext({ RequestId: scope.requestId });
|
|
94
|
+
if (responseHeader && res.setHeader) res.setHeader(responseHeader, scope.requestId);
|
|
95
|
+
let done = false;
|
|
96
|
+
const finish = () => {
|
|
97
|
+
if (done) return;
|
|
98
|
+
done = true;
|
|
99
|
+
scope.complete(res.statusCode);
|
|
100
|
+
};
|
|
101
|
+
res.on("finish", finish);
|
|
102
|
+
res.on("close", finish);
|
|
103
|
+
try {
|
|
104
|
+
next();
|
|
105
|
+
} catch (error) {
|
|
106
|
+
done = true;
|
|
107
|
+
scope.complete(500, error);
|
|
108
|
+
throw error;
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function errorLogger(options = {}) {
|
|
114
|
+
const logger = _nullishCoalesce(options.logger, () => ( _chunk3FU7DTQEcjs.log));
|
|
115
|
+
return (error, req, _res, next) => {
|
|
116
|
+
const target = _nullishCoalesce(req.log, () => ( logger));
|
|
117
|
+
target.error(error instanceof Error ? error : new Error(String(error)), "Unhandled error in {RequestMethod:l} {RequestPath:l}", _nullishCoalesce(req.method, () => ( "GET")), (_nullishCoalesce(_nullishCoalesce(req.originalUrl, () => ( req.url)), () => ( "/"))).split("?")[0]);
|
|
118
|
+
next(error);
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
exports.CLEF_MEDIA_TYPE = _chunk3FU7DTQEcjs.CLEF_MEDIA_TYPE; exports.DEFAULT_DESTRUCTURING = _chunk3FU7DTQEcjs.DEFAULT_DESTRUCTURING; exports.DEFAULT_OUTPUT_TEMPLATE = _chunk3FU7DTQEcjs.DEFAULT_OUTPUT_TEMPLATE; exports.LEVELS = _chunk3FU7DTQEcjs.LEVELS; exports.LEVEL_CODES = _chunk3FU7DTQEcjs.LEVEL_CODES; exports.LEVEL_NUMBERS = _chunk3FU7DTQEcjs.LEVEL_NUMBERS; exports.LEVEL_ORDER = _chunk3FU7DTQEcjs.LEVEL_ORDER; exports.LevelSwitch = _chunk3FU7DTQEcjs.LevelSwitch; exports.LogContext = _chunk3FU7DTQEcjs.LogContext; exports.LogEvent = _chunk3FU7DTQEcjs.LogEvent; exports.Logger = _chunk3FU7DTQEcjs.Logger; exports.LoggerConfiguration = _chunk3FU7DTQEcjs.LoggerConfiguration; exports.Matching = _chunk3FU7DTQEcjs.Matching; exports.Operation = _chunk3FU7DTQEcjs.Operation; exports.REQUEST_COMPLETION_TEMPLATE = _chunkSKS54NHBcjs.REQUEST_COMPLETION_TEMPLATE; exports.SERILOG_LEVEL_NAMES = _chunk3FU7DTQEcjs.SERILOG_LEVEL_NAMES; exports.ansi = _chunk3FU7DTQEcjs.ansi; exports.audit = _chunk3FU7DTQEcjs.audit; exports.batchingSink = _chunk3FU7DTQEcjs.batchingSink; exports.byExcluding = _chunk3FU7DTQEcjs.byExcluding; exports.byIncludingOnly = _chunk3FU7DTQEcjs.byIncludingOnly; exports.byTransforming = _chunk3FU7DTQEcjs.byTransforming; exports.callbackSink = _chunk3FU7DTQEcjs.callbackSink; exports.captureError = _chunk3FU7DTQEcjs.captureError; exports.captureProperty = _chunk3FU7DTQEcjs.captureProperty; exports.captureValue = _chunk3FU7DTQEcjs.captureValue; exports.clefFormatter = _chunk3FU7DTQEcjs.clefFormatter; exports.closeAndFlush = _chunk3FU7DTQEcjs.closeAndFlush; exports.conditional = _chunk3FU7DTQEcjs.conditional; exports.configure = _chunk3FU7DTQEcjs.configure; exports.consoleSink = _chunk3FU7DTQEcjs.consoleSink; exports.createLogger = _chunk3FU7DTQEcjs.createLogger; exports.detectColors = _chunk3FU7DTQEcjs.detectColors; exports.diagnosticContext = _chunk3FU7DTQEcjs.diagnosticContext; exports.errorLogger = errorLogger; exports.formatDate = _chunk3FU7DTQEcjs.formatDate; exports.formatError = _chunk3FU7DTQEcjs.formatError; exports.formatLevel = _chunk3FU7DTQEcjs.formatLevel; exports.formatNumber = _chunk3FU7DTQEcjs.formatNumber; exports.fromLogContext = _chunk3FU7DTQEcjs.fromLogContext; exports.httpSink = _chunk3FU7DTQEcjs.httpSink; exports.isLevel = _chunk3FU7DTQEcjs.isLevel; exports.isoTimestamp = _chunk3FU7DTQEcjs.isoTimestamp; exports.jsonFormatter = _chunk3FU7DTQEcjs.jsonFormatter; exports.jsonReplacer = _chunk3FU7DTQEcjs.jsonReplacer; exports.levelAtLeast = _chunk3FU7DTQEcjs.levelAtLeast; exports.log = _chunk3FU7DTQEcjs.log; exports.mapSink = _chunk3FU7DTQEcjs.mapSink; exports.memorySink = _chunk3FU7DTQEcjs.memorySink; exports.parseLevel = _chunk3FU7DTQEcjs.parseLevel; exports.parseTemplate = _chunk3FU7DTQEcjs.parseTemplate; exports.prettyFormatter = _chunk3FU7DTQEcjs.prettyFormatter; exports.rateLimited = _chunk3FU7DTQEcjs.rateLimited; exports.renderTemplate = _chunk3FU7DTQEcjs.renderTemplate; exports.renderValue = _chunk3FU7DTQEcjs.renderValue; exports.requestLogger = requestLogger; exports.resolveFormatter = _chunk3FU7DTQEcjs.resolveFormatter; exports.resolveLevel = _chunk3FU7DTQEcjs.resolveLevel; exports.resolveStyles = _chunk3FU7DTQEcjs.resolveStyles; exports.restricted = _chunk3FU7DTQEcjs.restricted; exports.sampled = _chunk3FU7DTQEcjs.sampled; exports.selfLog = _chunk3FU7DTQEcjs.selfLog; exports.seqSink = _chunk3FU7DTQEcjs.seqSink; exports.streamSink = _chunk3FU7DTQEcjs.streamSink; exports.templateHash = _chunk3FU7DTQEcjs.templateHash; exports.textFormatter = _chunk3FU7DTQEcjs.textFormatter; exports.toJson = _chunk3FU7DTQEcjs.toJson; exports.withComputed = _chunk3FU7DTQEcjs.withComputed; exports.withEnvironment = _chunk3FU7DTQEcjs.withEnvironment; exports.withProperties = _chunk3FU7DTQEcjs.withProperties; exports.withProperty = _chunk3FU7DTQEcjs.withProperty; exports.withTraceContext = _chunk3FU7DTQEcjs.withTraceContext;
|
|
195
|
+
//# sourceMappingURL=express.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/logit/logit/packages/logit/dist/express.cjs","../src/express.ts"],"names":[],"mappings":"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","file":"/home/runner/work/logit/logit/packages/logit/dist/express.cjs","sourcesContent":[null,"/**\n * `@unhingged/logit/express` — request logging for Express, Connect and\n * anything with `(req, res, next)` middleware: one completion event per\n * request, `req.log` bound to the request, ambient `RequestId` for every\n * log written while handling it.\n */\nimport { AsyncLocalStorage } from 'node:async_hooks';\nimport { LogContext } from './context';\nimport { type Logger, log } from './logger';\nimport { type RequestLoggingOptions, runRequestScope } from './request';\n\nexport * from './index';\nexport { REQUEST_COMPLETION_TEMPLATE, type RequestLoggingOptions, type RequestInfo } from './request';\n\nif (!LogContext.isAsync) LogContext.use(new AsyncLocalStorage());\n\n/** Structural — no dependency on `@types/express`. */\nexport interface IncomingRequest {\n method?: string;\n url?: string;\n originalUrl?: string;\n path?: string;\n headers: Record<string, string | string[] | undefined>;\n log?: Logger;\n}\n\nexport interface OutgoingResponse {\n statusCode: number;\n on(event: 'finish' | 'close', listener: () => void): unknown;\n setHeader?(name: string, value: string): unknown;\n}\n\nexport interface ExpressRequestLoggingOptions extends RequestLoggingOptions {\n /** Write the request id back as a response header. Default `'x-request-id'`; `false` to skip. */\n responseHeader?: string | false;\n /** Log the path without the query string. Default true. */\n stripQuery?: boolean;\n}\n\n/**\n * app.use(requestLogger());\n * app.get('/orders', (req, res) => { req.log.info('Listing {Count} orders', n); … });\n */\nexport function requestLogger(options: ExpressRequestLoggingOptions = {}) {\n const logger = options.logger ?? log;\n const responseHeader = options.responseHeader ?? 'x-request-id';\n const stripQuery = options.stripQuery ?? true;\n\n return (req: IncomingRequest, res: OutgoingResponse, next: (error?: unknown) => void): void => {\n const rawPath = req.originalUrl ?? req.url ?? req.path ?? '/';\n const path = stripQuery ? rawPath.split('?')[0] : rawPath;\n const info = { method: req.method ?? 'GET', path, url: rawPath, headers: req.headers };\n if (options.ignore?.(info)) {\n next();\n return;\n }\n runRequestScope(info, options, logger, (scope) => {\n req.log = logger.forContext({ RequestId: scope.requestId });\n if (responseHeader && res.setHeader) res.setHeader(responseHeader, scope.requestId);\n let done = false;\n const finish = () => {\n if (done) return;\n done = true;\n scope.complete(res.statusCode);\n };\n res.on('finish', finish);\n res.on('close', finish);\n try {\n next();\n } catch (error) {\n done = true;\n scope.complete(500, error);\n throw error;\n }\n });\n };\n}\n\n/**\n * An error-handling middleware that logs the error with the request's\n * context and passes it on. Mount it after the routes.\n */\nexport function errorLogger(options: { logger?: Logger } = {}) {\n const logger = options.logger ?? log;\n return (error: unknown, req: IncomingRequest, _res: OutgoingResponse, next: (error?: unknown) => void): void => {\n const target = req.log ?? logger;\n target.error(error instanceof Error ? error : new Error(String(error)), 'Unhandled error in {RequestMethod:l} {RequestPath:l}', req.method ?? 'GET', (req.originalUrl ?? req.url ?? '/').split('?')[0]);\n next(error);\n };\n}\n"]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Logger } from './index.cjs';
|
|
2
|
+
export { BatchingOptions, BatchingSink, CLEF_MEDIA_TYPE, CapturedError, ClefFormatterOptions, ConsoleSinkOptions, ContextFrame, ContextHandle, ContextStore, DEFAULT_DESTRUCTURING, DEFAULT_OUTPUT_TEMPLATE, DestructuringOptions, DestructuringPolicy, Enricher, FetchLike, Filter, FormatName, Formatter, HoleToken, HttpSinkOptions, JsonFormatterOptions, LEVELS, LEVEL_CODES, LEVEL_NUMBERS, LEVEL_ORDER, LevelOrSwitch, LevelSwitch, LogContext, LogEvent, LogEventInit, LogLevel, LogMethod, LoggerConfiguration, LoggerOptions, MapSinkOptions, Matching, MemorySink, MessageTemplate, Operation, OperationOptions, PrettyFormatterOptions, RenderOptions, SERILOG_LEVEL_NAMES, SeqSinkOptions, Sink, SinkOptions, StreamLike, StreamSinkOptions, TemplateToken, TextFormatterOptions, TextToken, TraceContext, ValueStyles, ansi, audit, batchingSink, byExcluding, byIncludingOnly, byTransforming, callbackSink, captureError, captureProperty, captureValue, clefFormatter, closeAndFlush, conditional, configure, consoleSink, createLogger, detectColors, diagnosticContext, formatDate, formatError, formatLevel, formatNumber, fromLogContext, httpSink, isLevel, isoTimestamp, jsonFormatter, jsonReplacer, levelAtLeast, log, mapSink, memorySink, parseLevel, parseTemplate, prettyFormatter, rateLimited, renderTemplate, renderValue, resolveFormatter, resolveLevel, resolveStyles, restricted, sampled, selfLog, seqSink, streamSink, templateHash, textFormatter, toJson, withComputed, withEnvironment, withProperties, withProperty, withTraceContext } from './index.cjs';
|
|
3
|
+
import { R as RequestLoggingOptions } from './request-DrVrbDze.cjs';
|
|
4
|
+
export { a as REQUEST_COMPLETION_TEMPLATE, b as RequestInfo } from './request-DrVrbDze.cjs';
|
|
5
|
+
|
|
6
|
+
/** Structural — no dependency on `@types/express`. */
|
|
7
|
+
interface IncomingRequest {
|
|
8
|
+
method?: string;
|
|
9
|
+
url?: string;
|
|
10
|
+
originalUrl?: string;
|
|
11
|
+
path?: string;
|
|
12
|
+
headers: Record<string, string | string[] | undefined>;
|
|
13
|
+
log?: Logger;
|
|
14
|
+
}
|
|
15
|
+
interface OutgoingResponse {
|
|
16
|
+
statusCode: number;
|
|
17
|
+
on(event: 'finish' | 'close', listener: () => void): unknown;
|
|
18
|
+
setHeader?(name: string, value: string): unknown;
|
|
19
|
+
}
|
|
20
|
+
interface ExpressRequestLoggingOptions extends RequestLoggingOptions {
|
|
21
|
+
/** Write the request id back as a response header. Default `'x-request-id'`; `false` to skip. */
|
|
22
|
+
responseHeader?: string | false;
|
|
23
|
+
/** Log the path without the query string. Default true. */
|
|
24
|
+
stripQuery?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* app.use(requestLogger());
|
|
28
|
+
* app.get('/orders', (req, res) => { req.log.info('Listing {Count} orders', n); … });
|
|
29
|
+
*/
|
|
30
|
+
declare function requestLogger(options?: ExpressRequestLoggingOptions): (req: IncomingRequest, res: OutgoingResponse, next: (error?: unknown) => void) => void;
|
|
31
|
+
/**
|
|
32
|
+
* An error-handling middleware that logs the error with the request's
|
|
33
|
+
* context and passes it on. Mount it after the routes.
|
|
34
|
+
*/
|
|
35
|
+
declare function errorLogger(options?: {
|
|
36
|
+
logger?: Logger;
|
|
37
|
+
}): (error: unknown, req: IncomingRequest, _res: OutgoingResponse, next: (error?: unknown) => void) => void;
|
|
38
|
+
|
|
39
|
+
export { type ExpressRequestLoggingOptions, type IncomingRequest, Logger, type OutgoingResponse, RequestLoggingOptions, errorLogger, requestLogger };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Logger } from './index.js';
|
|
2
|
+
export { BatchingOptions, BatchingSink, CLEF_MEDIA_TYPE, CapturedError, ClefFormatterOptions, ConsoleSinkOptions, ContextFrame, ContextHandle, ContextStore, DEFAULT_DESTRUCTURING, DEFAULT_OUTPUT_TEMPLATE, DestructuringOptions, DestructuringPolicy, Enricher, FetchLike, Filter, FormatName, Formatter, HoleToken, HttpSinkOptions, JsonFormatterOptions, LEVELS, LEVEL_CODES, LEVEL_NUMBERS, LEVEL_ORDER, LevelOrSwitch, LevelSwitch, LogContext, LogEvent, LogEventInit, LogLevel, LogMethod, LoggerConfiguration, LoggerOptions, MapSinkOptions, Matching, MemorySink, MessageTemplate, Operation, OperationOptions, PrettyFormatterOptions, RenderOptions, SERILOG_LEVEL_NAMES, SeqSinkOptions, Sink, SinkOptions, StreamLike, StreamSinkOptions, TemplateToken, TextFormatterOptions, TextToken, TraceContext, ValueStyles, ansi, audit, batchingSink, byExcluding, byIncludingOnly, byTransforming, callbackSink, captureError, captureProperty, captureValue, clefFormatter, closeAndFlush, conditional, configure, consoleSink, createLogger, detectColors, diagnosticContext, formatDate, formatError, formatLevel, formatNumber, fromLogContext, httpSink, isLevel, isoTimestamp, jsonFormatter, jsonReplacer, levelAtLeast, log, mapSink, memorySink, parseLevel, parseTemplate, prettyFormatter, rateLimited, renderTemplate, renderValue, resolveFormatter, resolveLevel, resolveStyles, restricted, sampled, selfLog, seqSink, streamSink, templateHash, textFormatter, toJson, withComputed, withEnvironment, withProperties, withProperty, withTraceContext } from './index.js';
|
|
3
|
+
import { R as RequestLoggingOptions } from './request-7cW3twuF.js';
|
|
4
|
+
export { a as REQUEST_COMPLETION_TEMPLATE, b as RequestInfo } from './request-7cW3twuF.js';
|
|
5
|
+
|
|
6
|
+
/** Structural — no dependency on `@types/express`. */
|
|
7
|
+
interface IncomingRequest {
|
|
8
|
+
method?: string;
|
|
9
|
+
url?: string;
|
|
10
|
+
originalUrl?: string;
|
|
11
|
+
path?: string;
|
|
12
|
+
headers: Record<string, string | string[] | undefined>;
|
|
13
|
+
log?: Logger;
|
|
14
|
+
}
|
|
15
|
+
interface OutgoingResponse {
|
|
16
|
+
statusCode: number;
|
|
17
|
+
on(event: 'finish' | 'close', listener: () => void): unknown;
|
|
18
|
+
setHeader?(name: string, value: string): unknown;
|
|
19
|
+
}
|
|
20
|
+
interface ExpressRequestLoggingOptions extends RequestLoggingOptions {
|
|
21
|
+
/** Write the request id back as a response header. Default `'x-request-id'`; `false` to skip. */
|
|
22
|
+
responseHeader?: string | false;
|
|
23
|
+
/** Log the path without the query string. Default true. */
|
|
24
|
+
stripQuery?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* app.use(requestLogger());
|
|
28
|
+
* app.get('/orders', (req, res) => { req.log.info('Listing {Count} orders', n); … });
|
|
29
|
+
*/
|
|
30
|
+
declare function requestLogger(options?: ExpressRequestLoggingOptions): (req: IncomingRequest, res: OutgoingResponse, next: (error?: unknown) => void) => void;
|
|
31
|
+
/**
|
|
32
|
+
* An error-handling middleware that logs the error with the request's
|
|
33
|
+
* context and passes it on. Mount it after the routes.
|
|
34
|
+
*/
|
|
35
|
+
declare function errorLogger(options?: {
|
|
36
|
+
logger?: Logger;
|
|
37
|
+
}): (error: unknown, req: IncomingRequest, _res: OutgoingResponse, next: (error?: unknown) => void) => void;
|
|
38
|
+
|
|
39
|
+
export { type ExpressRequestLoggingOptions, type IncomingRequest, Logger, type OutgoingResponse, RequestLoggingOptions, errorLogger, requestLogger };
|
package/dist/express.js
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import {
|
|
2
|
+
REQUEST_COMPLETION_TEMPLATE,
|
|
3
|
+
runRequestScope
|
|
4
|
+
} from "./chunk-7J27DQIR.js";
|
|
5
|
+
import {
|
|
6
|
+
CLEF_MEDIA_TYPE,
|
|
7
|
+
DEFAULT_DESTRUCTURING,
|
|
8
|
+
DEFAULT_OUTPUT_TEMPLATE,
|
|
9
|
+
LEVELS,
|
|
10
|
+
LEVEL_CODES,
|
|
11
|
+
LEVEL_NUMBERS,
|
|
12
|
+
LEVEL_ORDER,
|
|
13
|
+
LevelSwitch,
|
|
14
|
+
LogContext,
|
|
15
|
+
LogEvent,
|
|
16
|
+
Logger,
|
|
17
|
+
LoggerConfiguration,
|
|
18
|
+
Matching,
|
|
19
|
+
Operation,
|
|
20
|
+
SERILOG_LEVEL_NAMES,
|
|
21
|
+
ansi,
|
|
22
|
+
audit,
|
|
23
|
+
batchingSink,
|
|
24
|
+
byExcluding,
|
|
25
|
+
byIncludingOnly,
|
|
26
|
+
byTransforming,
|
|
27
|
+
callbackSink,
|
|
28
|
+
captureError,
|
|
29
|
+
captureProperty,
|
|
30
|
+
captureValue,
|
|
31
|
+
clefFormatter,
|
|
32
|
+
closeAndFlush,
|
|
33
|
+
conditional,
|
|
34
|
+
configure,
|
|
35
|
+
consoleSink,
|
|
36
|
+
createLogger,
|
|
37
|
+
detectColors,
|
|
38
|
+
diagnosticContext,
|
|
39
|
+
formatDate,
|
|
40
|
+
formatError,
|
|
41
|
+
formatLevel,
|
|
42
|
+
formatNumber,
|
|
43
|
+
fromLogContext,
|
|
44
|
+
httpSink,
|
|
45
|
+
isLevel,
|
|
46
|
+
isoTimestamp,
|
|
47
|
+
jsonFormatter,
|
|
48
|
+
jsonReplacer,
|
|
49
|
+
levelAtLeast,
|
|
50
|
+
log,
|
|
51
|
+
mapSink,
|
|
52
|
+
memorySink,
|
|
53
|
+
parseLevel,
|
|
54
|
+
parseTemplate,
|
|
55
|
+
prettyFormatter,
|
|
56
|
+
rateLimited,
|
|
57
|
+
renderTemplate,
|
|
58
|
+
renderValue,
|
|
59
|
+
resolveFormatter,
|
|
60
|
+
resolveLevel,
|
|
61
|
+
resolveStyles,
|
|
62
|
+
restricted,
|
|
63
|
+
sampled,
|
|
64
|
+
selfLog,
|
|
65
|
+
seqSink,
|
|
66
|
+
streamSink,
|
|
67
|
+
templateHash,
|
|
68
|
+
textFormatter,
|
|
69
|
+
toJson,
|
|
70
|
+
withComputed,
|
|
71
|
+
withEnvironment,
|
|
72
|
+
withProperties,
|
|
73
|
+
withProperty,
|
|
74
|
+
withTraceContext
|
|
75
|
+
} from "./chunk-GW7WQELF.js";
|
|
76
|
+
|
|
77
|
+
// src/express.ts
|
|
78
|
+
import { AsyncLocalStorage } from "async_hooks";
|
|
79
|
+
if (!LogContext.isAsync) LogContext.use(new AsyncLocalStorage());
|
|
80
|
+
function requestLogger(options = {}) {
|
|
81
|
+
const logger = options.logger ?? log;
|
|
82
|
+
const responseHeader = options.responseHeader ?? "x-request-id";
|
|
83
|
+
const stripQuery = options.stripQuery ?? true;
|
|
84
|
+
return (req, res, next) => {
|
|
85
|
+
const rawPath = req.originalUrl ?? req.url ?? req.path ?? "/";
|
|
86
|
+
const path = stripQuery ? rawPath.split("?")[0] : rawPath;
|
|
87
|
+
const info = { method: req.method ?? "GET", path, url: rawPath, headers: req.headers };
|
|
88
|
+
if (options.ignore?.(info)) {
|
|
89
|
+
next();
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
runRequestScope(info, options, logger, (scope) => {
|
|
93
|
+
req.log = logger.forContext({ RequestId: scope.requestId });
|
|
94
|
+
if (responseHeader && res.setHeader) res.setHeader(responseHeader, scope.requestId);
|
|
95
|
+
let done = false;
|
|
96
|
+
const finish = () => {
|
|
97
|
+
if (done) return;
|
|
98
|
+
done = true;
|
|
99
|
+
scope.complete(res.statusCode);
|
|
100
|
+
};
|
|
101
|
+
res.on("finish", finish);
|
|
102
|
+
res.on("close", finish);
|
|
103
|
+
try {
|
|
104
|
+
next();
|
|
105
|
+
} catch (error) {
|
|
106
|
+
done = true;
|
|
107
|
+
scope.complete(500, error);
|
|
108
|
+
throw error;
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function errorLogger(options = {}) {
|
|
114
|
+
const logger = options.logger ?? log;
|
|
115
|
+
return (error, req, _res, next) => {
|
|
116
|
+
const target = req.log ?? logger;
|
|
117
|
+
target.error(error instanceof Error ? error : new Error(String(error)), "Unhandled error in {RequestMethod:l} {RequestPath:l}", req.method ?? "GET", (req.originalUrl ?? req.url ?? "/").split("?")[0]);
|
|
118
|
+
next(error);
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
export {
|
|
122
|
+
CLEF_MEDIA_TYPE,
|
|
123
|
+
DEFAULT_DESTRUCTURING,
|
|
124
|
+
DEFAULT_OUTPUT_TEMPLATE,
|
|
125
|
+
LEVELS,
|
|
126
|
+
LEVEL_CODES,
|
|
127
|
+
LEVEL_NUMBERS,
|
|
128
|
+
LEVEL_ORDER,
|
|
129
|
+
LevelSwitch,
|
|
130
|
+
LogContext,
|
|
131
|
+
LogEvent,
|
|
132
|
+
Logger,
|
|
133
|
+
LoggerConfiguration,
|
|
134
|
+
Matching,
|
|
135
|
+
Operation,
|
|
136
|
+
REQUEST_COMPLETION_TEMPLATE,
|
|
137
|
+
SERILOG_LEVEL_NAMES,
|
|
138
|
+
ansi,
|
|
139
|
+
audit,
|
|
140
|
+
batchingSink,
|
|
141
|
+
byExcluding,
|
|
142
|
+
byIncludingOnly,
|
|
143
|
+
byTransforming,
|
|
144
|
+
callbackSink,
|
|
145
|
+
captureError,
|
|
146
|
+
captureProperty,
|
|
147
|
+
captureValue,
|
|
148
|
+
clefFormatter,
|
|
149
|
+
closeAndFlush,
|
|
150
|
+
conditional,
|
|
151
|
+
configure,
|
|
152
|
+
consoleSink,
|
|
153
|
+
createLogger,
|
|
154
|
+
detectColors,
|
|
155
|
+
diagnosticContext,
|
|
156
|
+
errorLogger,
|
|
157
|
+
formatDate,
|
|
158
|
+
formatError,
|
|
159
|
+
formatLevel,
|
|
160
|
+
formatNumber,
|
|
161
|
+
fromLogContext,
|
|
162
|
+
httpSink,
|
|
163
|
+
isLevel,
|
|
164
|
+
isoTimestamp,
|
|
165
|
+
jsonFormatter,
|
|
166
|
+
jsonReplacer,
|
|
167
|
+
levelAtLeast,
|
|
168
|
+
log,
|
|
169
|
+
mapSink,
|
|
170
|
+
memorySink,
|
|
171
|
+
parseLevel,
|
|
172
|
+
parseTemplate,
|
|
173
|
+
prettyFormatter,
|
|
174
|
+
rateLimited,
|
|
175
|
+
renderTemplate,
|
|
176
|
+
renderValue,
|
|
177
|
+
requestLogger,
|
|
178
|
+
resolveFormatter,
|
|
179
|
+
resolveLevel,
|
|
180
|
+
resolveStyles,
|
|
181
|
+
restricted,
|
|
182
|
+
sampled,
|
|
183
|
+
selfLog,
|
|
184
|
+
seqSink,
|
|
185
|
+
streamSink,
|
|
186
|
+
templateHash,
|
|
187
|
+
textFormatter,
|
|
188
|
+
toJson,
|
|
189
|
+
withComputed,
|
|
190
|
+
withEnvironment,
|
|
191
|
+
withProperties,
|
|
192
|
+
withProperty,
|
|
193
|
+
withTraceContext
|
|
194
|
+
};
|
|
195
|
+
//# sourceMappingURL=express.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/express.ts"],"sourcesContent":["/**\n * `@unhingged/logit/express` — request logging for Express, Connect and\n * anything with `(req, res, next)` middleware: one completion event per\n * request, `req.log` bound to the request, ambient `RequestId` for every\n * log written while handling it.\n */\nimport { AsyncLocalStorage } from 'node:async_hooks';\nimport { LogContext } from './context';\nimport { type Logger, log } from './logger';\nimport { type RequestLoggingOptions, runRequestScope } from './request';\n\nexport * from './index';\nexport { REQUEST_COMPLETION_TEMPLATE, type RequestLoggingOptions, type RequestInfo } from './request';\n\nif (!LogContext.isAsync) LogContext.use(new AsyncLocalStorage());\n\n/** Structural — no dependency on `@types/express`. */\nexport interface IncomingRequest {\n method?: string;\n url?: string;\n originalUrl?: string;\n path?: string;\n headers: Record<string, string | string[] | undefined>;\n log?: Logger;\n}\n\nexport interface OutgoingResponse {\n statusCode: number;\n on(event: 'finish' | 'close', listener: () => void): unknown;\n setHeader?(name: string, value: string): unknown;\n}\n\nexport interface ExpressRequestLoggingOptions extends RequestLoggingOptions {\n /** Write the request id back as a response header. Default `'x-request-id'`; `false` to skip. */\n responseHeader?: string | false;\n /** Log the path without the query string. Default true. */\n stripQuery?: boolean;\n}\n\n/**\n * app.use(requestLogger());\n * app.get('/orders', (req, res) => { req.log.info('Listing {Count} orders', n); … });\n */\nexport function requestLogger(options: ExpressRequestLoggingOptions = {}) {\n const logger = options.logger ?? log;\n const responseHeader = options.responseHeader ?? 'x-request-id';\n const stripQuery = options.stripQuery ?? true;\n\n return (req: IncomingRequest, res: OutgoingResponse, next: (error?: unknown) => void): void => {\n const rawPath = req.originalUrl ?? req.url ?? req.path ?? '/';\n const path = stripQuery ? rawPath.split('?')[0] : rawPath;\n const info = { method: req.method ?? 'GET', path, url: rawPath, headers: req.headers };\n if (options.ignore?.(info)) {\n next();\n return;\n }\n runRequestScope(info, options, logger, (scope) => {\n req.log = logger.forContext({ RequestId: scope.requestId });\n if (responseHeader && res.setHeader) res.setHeader(responseHeader, scope.requestId);\n let done = false;\n const finish = () => {\n if (done) return;\n done = true;\n scope.complete(res.statusCode);\n };\n res.on('finish', finish);\n res.on('close', finish);\n try {\n next();\n } catch (error) {\n done = true;\n scope.complete(500, error);\n throw error;\n }\n });\n };\n}\n\n/**\n * An error-handling middleware that logs the error with the request's\n * context and passes it on. Mount it after the routes.\n */\nexport function errorLogger(options: { logger?: Logger } = {}) {\n const logger = options.logger ?? log;\n return (error: unknown, req: IncomingRequest, _res: OutgoingResponse, next: (error?: unknown) => void): void => {\n const target = req.log ?? logger;\n target.error(error instanceof Error ? error : new Error(String(error)), 'Unhandled error in {RequestMethod:l} {RequestPath:l}', req.method ?? 'GET', (req.originalUrl ?? req.url ?? '/').split('?')[0]);\n next(error);\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,SAAS,yBAAyB;AAQlC,IAAI,CAAC,WAAW,QAAS,YAAW,IAAI,IAAI,kBAAkB,CAAC;AA6BxD,SAAS,cAAc,UAAwC,CAAC,GAAG;AACxE,QAAM,SAAS,QAAQ,UAAU;AACjC,QAAM,iBAAiB,QAAQ,kBAAkB;AACjD,QAAM,aAAa,QAAQ,cAAc;AAEzC,SAAO,CAAC,KAAsB,KAAuB,SAA0C;AAC7F,UAAM,UAAU,IAAI,eAAe,IAAI,OAAO,IAAI,QAAQ;AAC1D,UAAM,OAAO,aAAa,QAAQ,MAAM,GAAG,EAAE,CAAC,IAAI;AAClD,UAAM,OAAO,EAAE,QAAQ,IAAI,UAAU,OAAO,MAAM,KAAK,SAAS,SAAS,IAAI,QAAQ;AACrF,QAAI,QAAQ,SAAS,IAAI,GAAG;AAC1B,WAAK;AACL;AAAA,IACF;AACA,oBAAgB,MAAM,SAAS,QAAQ,CAAC,UAAU;AAChD,UAAI,MAAM,OAAO,WAAW,EAAE,WAAW,MAAM,UAAU,CAAC;AAC1D,UAAI,kBAAkB,IAAI,UAAW,KAAI,UAAU,gBAAgB,MAAM,SAAS;AAClF,UAAI,OAAO;AACX,YAAM,SAAS,MAAM;AACnB,YAAI,KAAM;AACV,eAAO;AACP,cAAM,SAAS,IAAI,UAAU;AAAA,MAC/B;AACA,UAAI,GAAG,UAAU,MAAM;AACvB,UAAI,GAAG,SAAS,MAAM;AACtB,UAAI;AACF,aAAK;AAAA,MACP,SAAS,OAAO;AACd,eAAO;AACP,cAAM,SAAS,KAAK,KAAK;AACzB,cAAM;AAAA,MACR;AAAA,IACF,CAAC;AAAA,EACH;AACF;AAMO,SAAS,YAAY,UAA+B,CAAC,GAAG;AAC7D,QAAM,SAAS,QAAQ,UAAU;AACjC,SAAO,CAAC,OAAgB,KAAsB,MAAwB,SAA0C;AAC9G,UAAM,SAAS,IAAI,OAAO;AAC1B,WAAO,MAAM,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,KAAK,CAAC,GAAG,wDAAwD,IAAI,UAAU,QAAQ,IAAI,eAAe,IAAI,OAAO,KAAK,MAAM,GAAG,EAAE,CAAC,CAAC;AACtM,SAAK,KAAK;AAAA,EACZ;AACF;","names":[]}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
var _chunk3FU7DTQEcjs = require('./chunk-3FU7DTQE.cjs');
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
exports.CLEF_MEDIA_TYPE = _chunk3FU7DTQEcjs.CLEF_MEDIA_TYPE; exports.DEFAULT_DESTRUCTURING = _chunk3FU7DTQEcjs.DEFAULT_DESTRUCTURING; exports.DEFAULT_OUTPUT_TEMPLATE = _chunk3FU7DTQEcjs.DEFAULT_OUTPUT_TEMPLATE; exports.LEVELS = _chunk3FU7DTQEcjs.LEVELS; exports.LEVEL_CODES = _chunk3FU7DTQEcjs.LEVEL_CODES; exports.LEVEL_NUMBERS = _chunk3FU7DTQEcjs.LEVEL_NUMBERS; exports.LEVEL_ORDER = _chunk3FU7DTQEcjs.LEVEL_ORDER; exports.LevelSwitch = _chunk3FU7DTQEcjs.LevelSwitch; exports.LogContext = _chunk3FU7DTQEcjs.LogContext; exports.LogEvent = _chunk3FU7DTQEcjs.LogEvent; exports.Logger = _chunk3FU7DTQEcjs.Logger; exports.LoggerConfiguration = _chunk3FU7DTQEcjs.LoggerConfiguration; exports.Matching = _chunk3FU7DTQEcjs.Matching; exports.Operation = _chunk3FU7DTQEcjs.Operation; exports.SERILOG_LEVEL_NAMES = _chunk3FU7DTQEcjs.SERILOG_LEVEL_NAMES; exports.ansi = _chunk3FU7DTQEcjs.ansi; exports.audit = _chunk3FU7DTQEcjs.audit; exports.batchingSink = _chunk3FU7DTQEcjs.batchingSink; exports.byExcluding = _chunk3FU7DTQEcjs.byExcluding; exports.byIncludingOnly = _chunk3FU7DTQEcjs.byIncludingOnly; exports.byTransforming = _chunk3FU7DTQEcjs.byTransforming; exports.callbackSink = _chunk3FU7DTQEcjs.callbackSink; exports.captureError = _chunk3FU7DTQEcjs.captureError; exports.captureProperty = _chunk3FU7DTQEcjs.captureProperty; exports.captureValue = _chunk3FU7DTQEcjs.captureValue; exports.clefFormatter = _chunk3FU7DTQEcjs.clefFormatter; exports.closeAndFlush = _chunk3FU7DTQEcjs.closeAndFlush; exports.conditional = _chunk3FU7DTQEcjs.conditional; exports.configure = _chunk3FU7DTQEcjs.configure; exports.consoleSink = _chunk3FU7DTQEcjs.consoleSink; exports.createLogger = _chunk3FU7DTQEcjs.createLogger; exports.detectColors = _chunk3FU7DTQEcjs.detectColors; exports.diagnosticContext = _chunk3FU7DTQEcjs.diagnosticContext; exports.formatDate = _chunk3FU7DTQEcjs.formatDate; exports.formatError = _chunk3FU7DTQEcjs.formatError; exports.formatLevel = _chunk3FU7DTQEcjs.formatLevel; exports.formatNumber = _chunk3FU7DTQEcjs.formatNumber; exports.fromLogContext = _chunk3FU7DTQEcjs.fromLogContext; exports.httpSink = _chunk3FU7DTQEcjs.httpSink; exports.isLevel = _chunk3FU7DTQEcjs.isLevel; exports.isoTimestamp = _chunk3FU7DTQEcjs.isoTimestamp; exports.jsonFormatter = _chunk3FU7DTQEcjs.jsonFormatter; exports.jsonReplacer = _chunk3FU7DTQEcjs.jsonReplacer; exports.levelAtLeast = _chunk3FU7DTQEcjs.levelAtLeast; exports.log = _chunk3FU7DTQEcjs.log; exports.mapSink = _chunk3FU7DTQEcjs.mapSink; exports.memorySink = _chunk3FU7DTQEcjs.memorySink; exports.parseLevel = _chunk3FU7DTQEcjs.parseLevel; exports.parseTemplate = _chunk3FU7DTQEcjs.parseTemplate; exports.prettyFormatter = _chunk3FU7DTQEcjs.prettyFormatter; exports.rateLimited = _chunk3FU7DTQEcjs.rateLimited; exports.renderTemplate = _chunk3FU7DTQEcjs.renderTemplate; exports.renderValue = _chunk3FU7DTQEcjs.renderValue; exports.resolveFormatter = _chunk3FU7DTQEcjs.resolveFormatter; exports.resolveLevel = _chunk3FU7DTQEcjs.resolveLevel; exports.resolveStyles = _chunk3FU7DTQEcjs.resolveStyles; exports.restricted = _chunk3FU7DTQEcjs.restricted; exports.sampled = _chunk3FU7DTQEcjs.sampled; exports.selfLog = _chunk3FU7DTQEcjs.selfLog; exports.seqSink = _chunk3FU7DTQEcjs.seqSink; exports.streamSink = _chunk3FU7DTQEcjs.streamSink; exports.templateHash = _chunk3FU7DTQEcjs.templateHash; exports.textFormatter = _chunk3FU7DTQEcjs.textFormatter; exports.toJson = _chunk3FU7DTQEcjs.toJson; exports.withComputed = _chunk3FU7DTQEcjs.withComputed; exports.withEnvironment = _chunk3FU7DTQEcjs.withEnvironment; exports.withProperties = _chunk3FU7DTQEcjs.withProperties; exports.withProperty = _chunk3FU7DTQEcjs.withProperty; exports.withTraceContext = _chunk3FU7DTQEcjs.withTraceContext;
|
|
143
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/logit/logit/packages/logit/dist/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,spHAAC","file":"/home/runner/work/logit/logit/packages/logit/dist/index.cjs"}
|