@aomex/logger 0.0.1
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/CHANGELOG.md +14 -0
- package/LICENSE +21 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +174 -0
- package/dist/index.js.map +1 -0
- package/package.json +48 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# @aomex/logger
|
|
2
|
+
|
|
3
|
+
## 0.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`146b6b5`](https://github.com/aomex/aomex/commit/146b6b5f09d4b9f557c1771686f3585bebf4cfc9) Thanks [@geekact](https://github.com/geekact)! - refactor(helper): 重命名 color 为 chalk
|
|
8
|
+
|
|
9
|
+
- [`7dfc135`](https://github.com/aomex/aomex/commit/7dfc13580f0ce86185a88b119ef10846cf591f52) Thanks [@geekact](https://github.com/geekact)! - feat(logger): 创建 web 插件
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`d3a2757`](https://github.com/aomex/aomex/commit/d3a2757b38391ad70a206d95eac09520c64e9b85), [`07c8575`](https://github.com/aomex/aomex/commit/07c857565ede4eca7e88de4e8c5e5f244f9d16cb), [`e80844a`](https://github.com/aomex/aomex/commit/e80844a6808fd0f3b9d613ec3163b06357316cae), [`146b6b5`](https://github.com/aomex/aomex/commit/146b6b5f09d4b9f557c1771686f3585bebf4cfc9), [`56f65c8`](https://github.com/aomex/aomex/commit/56f65c8509b40679272ed58f63e12d98e1818503), [`c6df4de`](https://github.com/aomex/aomex/commit/c6df4de61fc28f452f8a202c9a485e1a061b3eb6), [`79e19c1`](https://github.com/aomex/aomex/commit/79e19c1ae2a35b38580a4d2a27b6dde634345126), [`9adefaa`](https://github.com/aomex/aomex/commit/9adefaa8baaaafb7be610c7a98920c9830d10a3c), [`a8bb601`](https://github.com/aomex/aomex/commit/a8bb601acaf1e1d580511ae886a4ae99bf19f699), [`902597b`](https://github.com/aomex/aomex/commit/902597b2f98fda7e63f7419a5ef62ab2acb7c863), [`e8dee7c`](https://github.com/aomex/aomex/commit/e8dee7c3f064587cd2afb9cb95ab3341f63ccd27)]:
|
|
12
|
+
- @aomex/web@0.0.6
|
|
13
|
+
- @aomex/helper@0.0.3
|
|
14
|
+
- @aomex/core@0.0.5
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 geekact
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { WebContext, WebMiddleware } from '@aomex/web';
|
|
2
|
+
|
|
3
|
+
type Printer = (message: string, ...args: any[]) => any;
|
|
4
|
+
interface LoggerOptions {
|
|
5
|
+
requestFormat?: string | false;
|
|
6
|
+
responseFormat?: string | false;
|
|
7
|
+
printer?: Printer;
|
|
8
|
+
customTokens?: {
|
|
9
|
+
[key: string]: (ctx: WebContext) => string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
declare const logger: (options?: LoggerOptions) => WebMiddleware;
|
|
13
|
+
|
|
14
|
+
export { LoggerOptions, logger };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
// src/logger.ts
|
|
2
|
+
import { Readable } from "node:stream";
|
|
3
|
+
import util from "node:util";
|
|
4
|
+
import { middleware } from "@aomex/core";
|
|
5
|
+
|
|
6
|
+
// src/counter.ts
|
|
7
|
+
import { Transform } from "node:stream";
|
|
8
|
+
var Counter = class extends Transform {
|
|
9
|
+
length = 0;
|
|
10
|
+
_transform(chunk, _encoding, callback) {
|
|
11
|
+
this.length += chunk.length;
|
|
12
|
+
this.push(chunk);
|
|
13
|
+
callback();
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// src/format.ts
|
|
18
|
+
import prettyTime from "pretty-time";
|
|
19
|
+
import bytes from "bytes";
|
|
20
|
+
import { chalk } from "@aomex/helper";
|
|
21
|
+
import { statuses } from "@aomex/web";
|
|
22
|
+
var colorCodes = {
|
|
23
|
+
7: "magenta",
|
|
24
|
+
5: "red",
|
|
25
|
+
4: "yellow",
|
|
26
|
+
3: "cyan",
|
|
27
|
+
2: "green",
|
|
28
|
+
1: "green",
|
|
29
|
+
0: "yellow"
|
|
30
|
+
};
|
|
31
|
+
var format = (opts) => {
|
|
32
|
+
const {
|
|
33
|
+
message,
|
|
34
|
+
startTime,
|
|
35
|
+
method,
|
|
36
|
+
url,
|
|
37
|
+
contentLength,
|
|
38
|
+
statusCode = 404,
|
|
39
|
+
contentType = "-",
|
|
40
|
+
tokens = {},
|
|
41
|
+
finished
|
|
42
|
+
} = opts;
|
|
43
|
+
const args = [];
|
|
44
|
+
const formatted = message.replaceAll(/\[[^\]]+\]/g, (token) => {
|
|
45
|
+
token = token.slice(1, -1);
|
|
46
|
+
if (tokens[token]) {
|
|
47
|
+
args.push(tokens[token]());
|
|
48
|
+
return "%s";
|
|
49
|
+
}
|
|
50
|
+
switch (token) {
|
|
51
|
+
case "request":
|
|
52
|
+
args.push("<--");
|
|
53
|
+
return chalk.gray("%s");
|
|
54
|
+
case "response":
|
|
55
|
+
if (statusCode >= 400) {
|
|
56
|
+
args.push("xxx");
|
|
57
|
+
return chalk.red("%s");
|
|
58
|
+
}
|
|
59
|
+
if (finished === false) {
|
|
60
|
+
args.push("-x-");
|
|
61
|
+
return chalk.yellow("%s");
|
|
62
|
+
}
|
|
63
|
+
args.push("-->");
|
|
64
|
+
return chalk.gray("%s");
|
|
65
|
+
case "method":
|
|
66
|
+
args.push(method);
|
|
67
|
+
return chalk.bold("%s");
|
|
68
|
+
case "url":
|
|
69
|
+
args.push(url);
|
|
70
|
+
return chalk.gray("%s");
|
|
71
|
+
case "statusCode":
|
|
72
|
+
const c = colorCodes[statusCode / 100 | 0] || colorCodes[0];
|
|
73
|
+
args.push(statusCode.toString());
|
|
74
|
+
return chalk[c]("%s");
|
|
75
|
+
case "contentLength":
|
|
76
|
+
args.push(
|
|
77
|
+
statuses.empty[statusCode] || contentLength === 0 ? "0" : contentLength == null ? "-" : bytes(contentLength).toLowerCase()
|
|
78
|
+
);
|
|
79
|
+
return chalk.gray("%s");
|
|
80
|
+
case "contentType":
|
|
81
|
+
args.push(contentType);
|
|
82
|
+
return chalk.gray("%s");
|
|
83
|
+
case "time":
|
|
84
|
+
args.push(prettyTime(process.hrtime(startTime)));
|
|
85
|
+
return chalk.gray("%s");
|
|
86
|
+
default:
|
|
87
|
+
return `[${token}]`;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
return [formatted, ...args];
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
// src/logger.ts
|
|
94
|
+
var defaultPrinter = (message, ...args) => {
|
|
95
|
+
console.log(util.format(message, ...args));
|
|
96
|
+
};
|
|
97
|
+
var logger = (options = {}) => {
|
|
98
|
+
const {
|
|
99
|
+
requestFormat = " [request] [method] [url]",
|
|
100
|
+
responseFormat = " [response] [method] [url] [statusCode] [time] [contentLength]",
|
|
101
|
+
printer = defaultPrinter,
|
|
102
|
+
customTokens
|
|
103
|
+
} = options;
|
|
104
|
+
return middleware.web(async (ctx, next) => {
|
|
105
|
+
const start = process.hrtime();
|
|
106
|
+
const {
|
|
107
|
+
request: { method, url },
|
|
108
|
+
response
|
|
109
|
+
} = ctx;
|
|
110
|
+
const tokens = customTokens ? Object.fromEntries(
|
|
111
|
+
Object.entries(customTokens).map(([key, value]) => {
|
|
112
|
+
return [key, value.bind(null, ctx)];
|
|
113
|
+
})
|
|
114
|
+
) : {};
|
|
115
|
+
if (requestFormat) {
|
|
116
|
+
printer(
|
|
117
|
+
...format({
|
|
118
|
+
message: requestFormat,
|
|
119
|
+
tokens,
|
|
120
|
+
startTime: start,
|
|
121
|
+
method,
|
|
122
|
+
url
|
|
123
|
+
})
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
if (!responseFormat)
|
|
127
|
+
return next();
|
|
128
|
+
ctx.app.on("error", onError);
|
|
129
|
+
await next();
|
|
130
|
+
ctx.app.off("error", onError);
|
|
131
|
+
const body = response.body;
|
|
132
|
+
let counter;
|
|
133
|
+
if (body instanceof Readable && body.readable) {
|
|
134
|
+
ctx.send(body.pipe(counter = new Counter()));
|
|
135
|
+
}
|
|
136
|
+
const onfinish = onDone.bind(null, "finish");
|
|
137
|
+
const onclose = onDone.bind(null, "close");
|
|
138
|
+
response.once("finish", onfinish);
|
|
139
|
+
response.once("close", onclose);
|
|
140
|
+
function onError() {
|
|
141
|
+
printer(
|
|
142
|
+
...format({
|
|
143
|
+
message: responseFormat,
|
|
144
|
+
tokens,
|
|
145
|
+
startTime: start,
|
|
146
|
+
method,
|
|
147
|
+
url,
|
|
148
|
+
statusCode: response.statusCode,
|
|
149
|
+
contentLength: response.contentLength
|
|
150
|
+
})
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
function onDone(event) {
|
|
154
|
+
response.off("finish", onfinish);
|
|
155
|
+
response.off("close", onclose);
|
|
156
|
+
printer(
|
|
157
|
+
...format({
|
|
158
|
+
message: responseFormat,
|
|
159
|
+
tokens,
|
|
160
|
+
startTime: start,
|
|
161
|
+
method,
|
|
162
|
+
url,
|
|
163
|
+
statusCode: response.statusCode,
|
|
164
|
+
contentLength: counter ? counter.length : response.contentLength,
|
|
165
|
+
finished: event === "finish"
|
|
166
|
+
})
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
};
|
|
171
|
+
export {
|
|
172
|
+
logger
|
|
173
|
+
};
|
|
174
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/logger.ts","../src/counter.ts","../src/format.ts"],"sourcesContent":["import { Readable } from 'node:stream';\nimport util from 'node:util';\nimport { middleware } from '@aomex/core';\nimport type { WebContext, WebMiddleware } from '@aomex/web';\nimport { Counter } from './counter';\nimport { format } from './format';\n\ntype Printer = (message: string, ...args: any[]) => any;\n\nexport interface LoggerOptions {\n requestFormat?: string | false;\n responseFormat?: string | false;\n printer?: Printer;\n customTokens?: { [key: string]: (ctx: WebContext) => string };\n}\n\nconst defaultPrinter: Printer = (message, ...args) => {\n console.log(util.format(message, ...args));\n};\n\nexport const logger = (options: LoggerOptions = {}): WebMiddleware => {\n const {\n requestFormat = ' [request] [method] [url]',\n responseFormat = ' [response] [method] [url] [statusCode] [time] [contentLength]',\n printer = defaultPrinter,\n customTokens,\n } = options;\n\n return middleware.web(async (ctx, next) => {\n const start = process.hrtime();\n const {\n request: { method, url },\n response,\n } = ctx;\n const tokens = customTokens\n ? Object.fromEntries(\n Object.entries(customTokens).map(([key, value]) => {\n return [key, value.bind(null, ctx)];\n }),\n )\n : {};\n\n if (requestFormat) {\n printer(\n ...format({\n message: requestFormat!,\n tokens,\n startTime: start,\n method,\n url,\n }),\n );\n }\n\n if (!responseFormat) return next();\n\n ctx.app.on('error', onError);\n await next();\n ctx.app.off('error', onError);\n\n const body = response.body;\n let counter: Counter;\n\n if (body instanceof Readable && body.readable) {\n ctx.send(body.pipe((counter = new Counter())));\n }\n\n const onfinish = onDone.bind(null, 'finish');\n const onclose = onDone.bind(null, 'close');\n response.once('finish', onfinish);\n response.once('close', onclose);\n\n function onError() {\n printer(\n ...format({\n message: responseFormat as string,\n tokens,\n startTime: start,\n method,\n url,\n statusCode: response.statusCode,\n contentLength: response.contentLength,\n }),\n );\n }\n\n function onDone(event: 'finish' | 'close') {\n response.off('finish', onfinish);\n response.off('close', onclose);\n printer(\n ...format({\n message: responseFormat as string,\n tokens,\n startTime: start,\n method,\n url,\n statusCode: response.statusCode,\n contentLength: counter ? counter.length : response.contentLength,\n finished: event === 'finish',\n }),\n );\n }\n });\n};\n","import { Transform, TransformCallback } from 'node:stream';\n\nexport class Counter extends Transform {\n public length: number = 0;\n\n override _transform(\n chunk: any,\n _encoding: BufferEncoding,\n callback: TransformCallback,\n ): void {\n this.length += chunk.length;\n this.push(chunk);\n callback();\n }\n}\n","import prettyTime from 'pretty-time';\nimport bytes from 'bytes';\nimport { chalk } from '@aomex/helper';\nimport { statuses } from '@aomex/web';\n\nexport const colorCodes = <const>{\n 7: 'magenta',\n 5: 'red',\n 4: 'yellow',\n 3: 'cyan',\n 2: 'green',\n 1: 'green',\n 0: 'yellow',\n};\n\nexport const format = (opts: {\n message: string;\n startTime: [number, number];\n method: string;\n url: string;\n tokens?: { [key: string]: () => string };\n contentType?: string;\n contentLength?: number;\n statusCode?: number;\n finished?: boolean;\n}): [message: string, ...args: any[]] => {\n const {\n message,\n startTime,\n method,\n url,\n contentLength,\n statusCode = 404,\n contentType = '-',\n tokens = {},\n finished,\n } = opts;\n\n const args: string[] = [];\n const formatted = message.replaceAll(/\\[[^\\]]+\\]/g, (token) => {\n token = token.slice(1, -1);\n\n if (tokens[token]) {\n args.push(tokens[token]!());\n return '%s';\n }\n\n switch (token) {\n case 'request':\n args.push('<--');\n return chalk.gray('%s');\n case 'response':\n if (statusCode >= 400) {\n args.push('xxx');\n return chalk.red('%s');\n }\n if (finished === false) {\n args.push('-x-');\n return chalk.yellow('%s');\n }\n\n args.push('-->');\n return chalk.gray('%s');\n case 'method':\n args.push(method);\n return chalk.bold('%s');\n case 'url':\n args.push(url);\n return chalk.gray('%s');\n case 'statusCode':\n const c =\n colorCodes[((statusCode / 100) | 0) as keyof typeof colorCodes] ||\n colorCodes[0]!;\n args.push(statusCode.toString());\n return chalk[c]('%s');\n case 'contentLength':\n args.push(\n statuses.empty[statusCode] || contentLength === 0\n ? '0'\n : contentLength == null\n ? '-'\n : bytes(contentLength).toLowerCase(),\n );\n return chalk.gray('%s');\n case 'contentType':\n args.push(contentType);\n return chalk.gray('%s');\n case 'time':\n args.push(prettyTime(process.hrtime(startTime)));\n return chalk.gray('%s');\n default:\n return `[${token}]`;\n }\n });\n\n return [formatted, ...args];\n};\n"],"mappings":";AAAA,SAAS,gBAAgB;AACzB,OAAO,UAAU;AACjB,SAAS,kBAAkB;;;ACF3B,SAAS,iBAAoC;AAEtC,IAAM,UAAN,cAAsB,UAAU;AAAA,EAC9B,SAAiB;AAAA,EAEf,WACP,OACA,WACA,UACM;AACN,SAAK,UAAU,MAAM;AACrB,SAAK,KAAK,KAAK;AACf,aAAS;AAAA,EACX;AACF;;;ACdA,OAAO,gBAAgB;AACvB,OAAO,WAAW;AAClB,SAAS,aAAa;AACtB,SAAS,gBAAgB;AAElB,IAAM,aAAoB;AAAA,EAC/B,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEO,IAAM,SAAS,CAAC,SAUkB;AACv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AEA,UAAM,WAAW,OAAO,KAAK,MAAM,QAAQ;AAC3C,UAAM,UAAU,OAAO,KAAK,MAAM,OAAO;AACzC,aAAS,KAAK,UAAU,QAAQ;AAChC,aAAS,KAAK,SAAS,OAAO;AAE9B,aAAS,UAAU;AACjB;AAAA,QACE,GAAG,OAAO;AAAA,UACR,SAAS;AAAA,UACT;AAAA,UACA,WAAW;AAAA,UACX;AAAA,UACA;AAAA,UACA,YAAY,SAAS;AAAA,UACrB,eAAe,SAAS;AAAA,QAC1B,CAAC;AAAA,MACH;AAAA,IACF;AAEA,aAAS,OAAO,OAA2B;AACzC,eAAS,IAAI,UAAU,QAAQ;AAC/B,eAAS,IAAI,SAAS,OAAO;AAC7B;AAAA,QACE,GAAG,OAAO;AAAA,UACR,SAAS;AAAA,UACT;AAAA,UACA,WAAW;AAAA,UACX;AAAA,UACA;AAAA,UACA,YAAY,SAAS;AAAA,UACrB,eAAe,UAAU,QAAQ,SAAS,SAAS;AAAA,UACnD,UAAU,UAAU;AAAA,QACtB,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF,CAAC;AACH;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aomex/logger",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "网络请求日志",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"api-request-logger"
|
|
7
|
+
],
|
|
8
|
+
"repository": "git@github.com:aomex/aomex.git",
|
|
9
|
+
"homepage": "https://aomex.js.org",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"type": "module",
|
|
12
|
+
"sideEffects": false,
|
|
13
|
+
"types": "dist/index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./package.json": "./package.json"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist",
|
|
23
|
+
"LICENSE",
|
|
24
|
+
"package.json",
|
|
25
|
+
"README.md",
|
|
26
|
+
"CHANGELOG.md"
|
|
27
|
+
],
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"@aomex/core": "^0.0.5",
|
|
33
|
+
"@aomex/web": "^0.0.6"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@aomex/helper": "0.0.3",
|
|
37
|
+
"bytes": "^3.1.2",
|
|
38
|
+
"pretty-time": "^1.1.0"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@aomex/core": "^0.0.5",
|
|
42
|
+
"@aomex/web": "^0.0.6",
|
|
43
|
+
"@types/bytes": "^3.1.1",
|
|
44
|
+
"@types/pretty-time": "^1.1.2",
|
|
45
|
+
"strip-ansi": "^7.0.1"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {}
|
|
48
|
+
}
|