@loggerjs/node 0.0.1 → 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/README.md +82 -21
- package/dist/bullmq-integration.d.ts +9 -0
- package/dist/bullmq-integration.d.ts.map +1 -0
- package/dist/hapi-integration.d.ts +44 -0
- package/dist/hapi-integration.d.ts.map +1 -0
- package/dist/http-transport.d.ts +2 -1
- package/dist/http-transport.d.ts.map +1 -1
- package/dist/index.cjs +412 -166
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +407 -168
- package/dist/index.js.map +1 -1
- package/dist/koa-integration.d.ts +26 -0
- package/dist/koa-integration.d.ts.map +1 -0
- package/dist/nest-integration.d.ts +5 -0
- package/dist/nest-integration.d.ts.map +1 -0
- package/dist/payload-transforms.d.ts +12 -0
- package/dist/payload-transforms.d.ts.map +1 -0
- package/dist/prisma-integration.d.ts +6 -0
- package/dist/prisma-integration.d.ts.map +1 -0
- package/dist/process-integration.d.ts +4 -0
- package/dist/process-integration.d.ts.map +1 -1
- package/dist/redis-integration.d.ts +7 -0
- package/dist/redis-integration.d.ts.map +1 -0
- package/package.json +37 -2
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type LoggerLevel, type LoggerLike } from "@loggerjs/core";
|
|
2
|
+
export interface KoaContextLike {
|
|
3
|
+
method?: string;
|
|
4
|
+
originalUrl?: string;
|
|
5
|
+
url?: string;
|
|
6
|
+
path?: string;
|
|
7
|
+
status?: number;
|
|
8
|
+
ip?: string;
|
|
9
|
+
state?: Record<string, unknown>;
|
|
10
|
+
request?: {
|
|
11
|
+
headers?: Record<string, string | string[] | undefined>;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export type KoaNext = () => Promise<unknown>;
|
|
15
|
+
export type KoaMiddleware = (ctx: KoaContextLike, next: KoaNext) => Promise<void>;
|
|
16
|
+
export interface KoaIntegrationOptions {
|
|
17
|
+
minStatus?: number;
|
|
18
|
+
captureAll?: boolean;
|
|
19
|
+
bindContext?: boolean;
|
|
20
|
+
sanitizeUrl?: (url: string) => string;
|
|
21
|
+
getRequestId?: (ctx: KoaContextLike) => string | undefined;
|
|
22
|
+
context?: (ctx: KoaContextLike) => Record<string, unknown> | undefined;
|
|
23
|
+
level?: (status: number, ctx: KoaContextLike, error: unknown) => LoggerLevel;
|
|
24
|
+
}
|
|
25
|
+
export declare function koaIntegration(logger: LoggerLike, options?: KoaIntegrationOptions): KoaMiddleware;
|
|
26
|
+
//# sourceMappingURL=koa-integration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"koa-integration.d.ts","sourceRoot":"","sources":["../src/koa-integration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,WAAW,EAAE,KAAK,UAAU,EAAgB,MAAM,gBAAgB,CAAC;AAE9F,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAA;KAAE,CAAC;CACvE;AAED,MAAM,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;AAC7C,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAElF,MAAM,WAAW,qBAAqB;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;IACtC,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,cAAc,KAAK,MAAM,GAAG,SAAS,CAAC;IAC3D,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,cAAc,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IACvE,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,OAAO,KAAK,WAAW,CAAC;CAC9E;AAYD,wBAAgB,cAAc,CAC5B,MAAM,EAAE,UAAU,EAClB,OAAO,GAAE,qBAA0B,GAClC,aAAa,CAuCf"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { LoggerLike } from "@loggerjs/core";
|
|
2
|
+
import { type ExpressIntegrationOptions, type ExpressRequestHandler } from "./express-integration.js";
|
|
3
|
+
export type NestMiddleware = ExpressRequestHandler;
|
|
4
|
+
export declare function nestMiddlewareIntegration(logger: LoggerLike, options?: ExpressIntegrationOptions): NestMiddleware;
|
|
5
|
+
//# sourceMappingURL=nest-integration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nest-integration.d.ts","sourceRoot":"","sources":["../src/nest-integration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAEL,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,EAC3B,MAAM,uBAAuB,CAAC;AAE/B,MAAM,MAAM,cAAc,GAAG,qBAAqB,CAAC;AAEnD,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,UAAU,EAClB,OAAO,GAAE,yBAA8B,GACtC,cAAc,CAKhB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type BrotliOptions, type ZlibOptions } from "node:zlib";
|
|
2
|
+
import { type PayloadTransform } from "@loggerjs/core";
|
|
3
|
+
export type NodeCompressionFormat = "gzip" | "brotli" | "deflate";
|
|
4
|
+
export interface NodeCompressionPayloadTransformOptions {
|
|
5
|
+
format?: NodeCompressionFormat;
|
|
6
|
+
gzipOptions?: ZlibOptions;
|
|
7
|
+
brotliOptions?: BrotliOptions;
|
|
8
|
+
deflateOptions?: ZlibOptions;
|
|
9
|
+
headers?: Record<string, string>;
|
|
10
|
+
}
|
|
11
|
+
export declare function nodeCompressionPayloadTransform(options?: NodeCompressionPayloadTransformOptions): PayloadTransform;
|
|
12
|
+
//# sourceMappingURL=payload-transforms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payload-transforms.d.ts","sourceRoot":"","sources":["../src/payload-transforms.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,WAAW,EACjB,MAAM,WAAW,CAAC;AACnB,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,gBAAgB,CAAC;AAExB,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;AAElE,MAAM,WAAW,sCAAsC;IACrD,MAAM,CAAC,EAAE,qBAAqB,CAAC;IAC/B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,cAAc,CAAC,EAAE,WAAW,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAmBD,wBAAgB,+BAA+B,CAC7C,OAAO,GAAE,sCAA2C,GACnD,gBAAgB,CASlB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type DatabaseClientLike, type DatabaseIntegrationOptions } from "./database-integration.js";
|
|
2
|
+
export interface PrismaIntegrationOptions extends Omit<DatabaseIntegrationOptions, "client" | "system" | "methods" | "getStatement"> {
|
|
3
|
+
client: DatabaseClientLike;
|
|
4
|
+
}
|
|
5
|
+
export declare function prismaIntegration(options: PrismaIntegrationOptions): import("@loggerjs/core").Integration;
|
|
6
|
+
//# sourceMappingURL=prisma-integration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prisma-integration.d.ts","sourceRoot":"","sources":["../src/prisma-integration.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,0BAA0B,EAChC,MAAM,wBAAwB,CAAC;AAEhC,MAAM,WAAW,wBAAyB,SAAQ,IAAI,CACpD,0BAA0B,EAC1B,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,cAAc,CACjD;IACC,MAAM,EAAE,kBAAkB,CAAC;CAC5B;AAWD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,wCAQlE"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { type Integration } from "@loggerjs/core";
|
|
2
|
+
export type ProcessSignal = "SIGHUP" | "SIGINT" | "SIGQUIT" | "SIGTERM";
|
|
2
3
|
export interface CaptureProcessOptions {
|
|
3
4
|
uncaughtException?: boolean;
|
|
4
5
|
unhandledRejection?: boolean;
|
|
5
6
|
warning?: boolean;
|
|
6
7
|
beforeExitFlush?: boolean;
|
|
7
8
|
exitFlush?: boolean;
|
|
9
|
+
signalFlush?: boolean;
|
|
10
|
+
signals?: ProcessSignal[];
|
|
11
|
+
exitOnSignal?: boolean;
|
|
8
12
|
exitOnUncaught?: boolean;
|
|
9
13
|
flushTimeoutMs?: number;
|
|
10
14
|
exitFn?: (code: number) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-integration.d.ts","sourceRoot":"","sources":["../src/process-integration.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,WAAW,EAEjB,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,qBAAqB;IACpC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC;
|
|
1
|
+
{"version":3,"file":"process-integration.d.ts","sourceRoot":"","sources":["../src/process-integration.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,WAAW,EAEjB,MAAM,gBAAgB,CAAC;AAExB,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;AAExE,MAAM,WAAW,qBAAqB;IACpC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,aAAa,EAAE,CAAC;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC;AAOD,wBAAgB,yBAAyB,CAAC,OAAO,GAAE,qBAA0B,GAAG,WAAW,CA6I1F"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type DatabaseClientLike, type DatabaseIntegrationOptions } from "./database-integration.js";
|
|
2
|
+
export interface RedisIntegrationOptions extends Omit<DatabaseIntegrationOptions, "client" | "system" | "methods" | "getStatement"> {
|
|
3
|
+
client: DatabaseClientLike;
|
|
4
|
+
methods?: readonly string[];
|
|
5
|
+
}
|
|
6
|
+
export declare function redisIntegration(options: RedisIntegrationOptions): import("@loggerjs/core").Integration;
|
|
7
|
+
//# sourceMappingURL=redis-integration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redis-integration.d.ts","sourceRoot":"","sources":["../src/redis-integration.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,0BAA0B,EAChC,MAAM,wBAAwB,CAAC;AAEhC,MAAM,WAAW,uBAAwB,SAAQ,IAAI,CACnD,0BAA0B,EAC1B,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,cAAc,CACjD;IACC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7B;AAmBD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,wCAQhE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loggerjs/node",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Node.js transports and integrations for loggerjs.",
|
|
5
5
|
"homepage": "https://github.com/jskits/loggerjs/tree/main/packages/node#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -33,6 +33,11 @@
|
|
|
33
33
|
"import": "./dist/index.js",
|
|
34
34
|
"require": "./dist/index.cjs"
|
|
35
35
|
},
|
|
36
|
+
"./payload-transforms": {
|
|
37
|
+
"types": "./dist/index.d.ts",
|
|
38
|
+
"import": "./dist/index.js",
|
|
39
|
+
"require": "./dist/index.cjs"
|
|
40
|
+
},
|
|
36
41
|
"./transport-file": {
|
|
37
42
|
"types": "./dist/index.d.ts",
|
|
38
43
|
"import": "./dist/index.js",
|
|
@@ -68,11 +73,41 @@
|
|
|
68
73
|
"import": "./dist/index.js",
|
|
69
74
|
"require": "./dist/index.cjs"
|
|
70
75
|
},
|
|
76
|
+
"./integration-koa": {
|
|
77
|
+
"types": "./dist/index.d.ts",
|
|
78
|
+
"import": "./dist/index.js",
|
|
79
|
+
"require": "./dist/index.cjs"
|
|
80
|
+
},
|
|
81
|
+
"./integration-nest": {
|
|
82
|
+
"types": "./dist/index.d.ts",
|
|
83
|
+
"import": "./dist/index.js",
|
|
84
|
+
"require": "./dist/index.cjs"
|
|
85
|
+
},
|
|
86
|
+
"./integration-hapi": {
|
|
87
|
+
"types": "./dist/index.d.ts",
|
|
88
|
+
"import": "./dist/index.js",
|
|
89
|
+
"require": "./dist/index.cjs"
|
|
90
|
+
},
|
|
91
|
+
"./integration-prisma": {
|
|
92
|
+
"types": "./dist/index.d.ts",
|
|
93
|
+
"import": "./dist/index.js",
|
|
94
|
+
"require": "./dist/index.cjs"
|
|
95
|
+
},
|
|
96
|
+
"./integration-redis": {
|
|
97
|
+
"types": "./dist/index.d.ts",
|
|
98
|
+
"import": "./dist/index.js",
|
|
99
|
+
"require": "./dist/index.cjs"
|
|
100
|
+
},
|
|
71
101
|
"./integration-queue": {
|
|
72
102
|
"types": "./dist/index.d.ts",
|
|
73
103
|
"import": "./dist/index.js",
|
|
74
104
|
"require": "./dist/index.cjs"
|
|
75
105
|
},
|
|
106
|
+
"./integration-bullmq": {
|
|
107
|
+
"types": "./dist/index.d.ts",
|
|
108
|
+
"import": "./dist/index.js",
|
|
109
|
+
"require": "./dist/index.cjs"
|
|
110
|
+
},
|
|
76
111
|
"./integration-serverless": {
|
|
77
112
|
"types": "./dist/index.d.ts",
|
|
78
113
|
"import": "./dist/index.js",
|
|
@@ -119,7 +154,7 @@
|
|
|
119
154
|
"provenance": true
|
|
120
155
|
},
|
|
121
156
|
"dependencies": {
|
|
122
|
-
"@loggerjs/core": "0.0
|
|
157
|
+
"@loggerjs/core": "0.1.0"
|
|
123
158
|
},
|
|
124
159
|
"scripts": {
|
|
125
160
|
"build": "pnpm run clean && pnpm run build:js && pnpm run build:types",
|