@cto.af/log 0.0.1 → 0.0.3
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/lib/index.d.ts +4 -3
- package/lib/index.js +1 -1
- package/package.json +6 -1
package/lib/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ interface LogOptions extends pino.LoggerOptions<never, false> {
|
|
|
19
19
|
*/
|
|
20
20
|
prettyIgnore?: string;
|
|
21
21
|
}
|
|
22
|
+
type Logger = pino.Logger;
|
|
22
23
|
/**
|
|
23
24
|
* Create a new log instance. Mostly useful for testing.
|
|
24
25
|
*
|
|
@@ -26,7 +27,7 @@ interface LogOptions extends pino.LoggerOptions<never, false> {
|
|
|
26
27
|
* @param bindings Extra fields to put into every log item.
|
|
27
28
|
* @returns Logging object.
|
|
28
29
|
*/
|
|
29
|
-
declare function createLog(opts?: LogOptions, bindings?: pino.Bindings):
|
|
30
|
+
declare function createLog(opts?: LogOptions, bindings?: pino.Bindings): Logger;
|
|
30
31
|
/**
|
|
31
32
|
* Get a singleton logging object. Opts and bindings are used the first time,
|
|
32
33
|
* and ignored thereafter.
|
|
@@ -35,6 +36,6 @@ declare function createLog(opts?: LogOptions, bindings?: pino.Bindings): pino.Lo
|
|
|
35
36
|
* @param bindings Extra fields to put into every log item.
|
|
36
37
|
* @returns Singleton logging object.
|
|
37
38
|
*/
|
|
38
|
-
declare function getLog(opts: LogOptions, bindings?: pino.Bindings):
|
|
39
|
+
declare function getLog(opts: LogOptions, bindings?: pino.Bindings): Logger;
|
|
39
40
|
|
|
40
|
-
export { type LogOptions, createLog, getLog };
|
|
41
|
+
export { type LogOptions, type Logger, createLog, getLog };
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Writable as m}from"node:stream";import{pino as o}from"pino";import u from"pino-pretty";var p=class extends m{_write(
|
|
1
|
+
import{Writable as m}from"node:stream";import{pino as o}from"pino";import u from"pino-pretty";var p=class extends m{_write(r,s,i){i(null)}};function c(l={},r){let{logLevel:s,logFile:i,mute:d=!1,sync:a=!1,prettyIgnore:f="pid,hostname,name,host,port",...n}=l;if(s!==void 0){let e=Math.round(3-s);e<1?e=1:e>6&&(e=6),n.level=o.levels.labels[e*10]}let t;if(d&&!i)t=o(n,new p);else if(i){let e=o.destination({dest:i,sync:a,append:!0,mkdir:!0});d?t=o(n,e):t=o(n,o.multistream([{level:n.level,stream:e},{level:n.level,stream:u({ignore:f})}]))}else t=o(n,u({ignore:f}));return r&&t.setBindings(r),t}var g;function b(l,r={}){return g||(g=c(l,r)),g}export{c as createLog,b as getLog};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cto.af/log",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"decription": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"files": [
|
|
@@ -22,6 +22,11 @@
|
|
|
22
22
|
"pino": "9.6.0",
|
|
23
23
|
"pino-pretty": "13.0.0"
|
|
24
24
|
},
|
|
25
|
+
"pnpm": {
|
|
26
|
+
"overrides": {
|
|
27
|
+
"esbuild": "^0.25.0"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
25
30
|
"packageManager": "pnpm@10.4.1",
|
|
26
31
|
"engines": {
|
|
27
32
|
"node": ">=18.13 >=19.1"
|