@ichaingo/logger 1.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 ADDED
@@ -0,0 +1,11 @@
1
+ # logger
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ ## Building
6
+
7
+ Run `nx build logger` to build the library.
8
+
9
+ ## Running unit tests
10
+
11
+ Run `nx test logger` to execute the unit tests via [Vitest](https://vitest.dev/).
@@ -0,0 +1,4 @@
1
+ import { default as pino } from 'pino';
2
+ export type { Level } from 'pino';
3
+ export declare const logger: pino.Logger<never, boolean>;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,YAAY,EAAE,KAAK,EAAE,MAAM,MAAM,CAAA;AAMjC,eAAO,MAAM,MAAM,6BAyBjB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,31 @@
1
+ import e from "pino";
2
+ const n = process.env.NODE_ENV === "production" ? "info" : "trace", i = process.env.NEXT_PUBLIC_ICHAINGO_SEARCH_BASEURL || "", r = `${i}/api/logger`, p = e({
3
+ level: n,
4
+ // 设置输出的日志级别,只输出指定级别及以上的日志
5
+ timestamp: e.stdTimeFunctions.isoTime,
6
+ // 设置时间戳格式
7
+ browser: {
8
+ // 参见 https://github.com/pinojs/pino/issues/1795
9
+ write: () => {
10
+ },
11
+ // 禁止在浏览器控制台输出日志
12
+ asObject: !0,
13
+ // 配置将浏览器和中间件的日志发送到服务器
14
+ transmit: {
15
+ send: (o, s) => {
16
+ const t = s.messages;
17
+ fetch(r, {
18
+ method: "POST",
19
+ headers: {
20
+ "Content-Type": "application/json"
21
+ },
22
+ body: JSON.stringify({ level: o, messages: t }),
23
+ keepalive: !0
24
+ });
25
+ }
26
+ }
27
+ }
28
+ });
29
+ export {
30
+ p as logger
31
+ };
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@ichaingo/logger",
3
+ "version": "1.1.0",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ "./package.json": "./package.json",
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "default": "./dist/index.js"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "!**/*.tsbuildinfo"
19
+ ],
20
+ "dependencies": {
21
+ "pino": "^9.9.4"
22
+ }
23
+ }