klg-logger
Advanced tools
Comparing version 2.0.1-1 to 2.0.1
import { Tracer } from 'tracer'; | ||
export declare type KlgTransportFunction = (data: Tracer.LogOutput) => void; | ||
/** | ||
* Tracer 的 tsd 文件把 transport 参数类型搞错了,这里更正一下,已经 PR | ||
* typescript 不支持 overwrite interface property,所以这里只能重新定义一遍了 | ||
*/ | ||
export interface LoggerConfig { | ||
format?: string; | ||
dateformat?: string; | ||
filters?: Tracer.FilterFunction[]; | ||
level?: string; | ||
methods?: string[]; | ||
stackIndex?: number; | ||
inspectOpt?: { | ||
showHidden: boolean; | ||
depth: number; | ||
}; | ||
preprocess?(data: Tracer.LogOutput): void; | ||
transport?: KlgTransportFunction | KlgTransportFunction[]; | ||
} | ||
/** | ||
* console 是一个没有 constructor 属性的 function,不能直接 class Logger extends console | ||
@@ -26,3 +7,3 @@ * 所以需要通过 Function 来做一个桥接,在 Function 的 constructor 中 return console 实例 | ||
export declare class Logger extends Function implements Tracer.Logger { | ||
constructor(config?: LoggerConfig); | ||
constructor(config?: Tracer.LoggerConfig); | ||
debug(...args: any[]): Tracer.LogOutput; | ||
@@ -29,0 +10,0 @@ err(...args: any[]): Tracer.LogOutput; |
@@ -10,2 +10,6 @@ "use strict"; | ||
stackIndex: 1, | ||
filters: [function (data) { | ||
console.log('filters', data); | ||
return data; | ||
}], | ||
transport: function (data) { | ||
@@ -12,0 +16,0 @@ console.log('data', data); |
{ | ||
"name": "klg-logger", | ||
"version": "2.0.1-1", | ||
"version": "2.0.1", | ||
"description": "log 工具,基于 tracer,简单,可以显示 log 的位置", | ||
@@ -25,3 +25,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"tracer": "^0.8.15" | ||
"tracer": "^0.9.1" | ||
}, | ||
@@ -28,0 +28,0 @@ "devDependencies": { |
@@ -10,2 +10,6 @@ import * as assert from 'power-assert' | ||
stackIndex: 1, | ||
filters: [function (data) { | ||
console.log('filters', data); | ||
return data | ||
}], | ||
transport: function (data) { | ||
@@ -12,0 +16,0 @@ console.log('data', data); |
import {console, Tracer} from 'tracer' | ||
export type KlgTransportFunction = (data: Tracer.LogOutput) => void | ||
/** | ||
* Tracer 的 tsd 文件把 transport 参数类型搞错了,这里更正一下,已经 PR | ||
* typescript 不支持 overwrite interface property,所以这里只能重新定义一遍了 | ||
*/ | ||
export interface LoggerConfig { | ||
format?: string | ||
dateformat?: string | ||
filters?: Tracer.FilterFunction[] | ||
level?: string | ||
methods?: string[] | ||
/* get the specified index of stack as file information. It is userful for development package. */ | ||
stackIndex?: number | ||
inspectOpt?: { | ||
/* if true then the object's non-enumerable properties will be shown too. Defaults to false */ | ||
showHidden: boolean, | ||
depth: number | ||
} | ||
preprocess? (data: Tracer.LogOutput): void | ||
transport?: KlgTransportFunction | KlgTransportFunction[] | ||
} | ||
/** | ||
* console 是一个没有 constructor 属性的 function,不能直接 class Logger extends console | ||
@@ -34,3 +8,3 @@ * 所以需要通过 Function 来做一个桥接,在 Function 的 constructor 中 return console 实例 | ||
export class Logger extends Function implements Tracer.Logger { | ||
constructor (config?: LoggerConfig) { | ||
constructor (config?: Tracer.LoggerConfig) { | ||
super() | ||
@@ -37,0 +11,0 @@ Object.setPrototypeOf(console, Logger.prototype) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
10555
275
+ Added@babel/code-frame@7.26.2(transitive)
+ Added@babel/generator@7.26.2(transitive)
+ Added@babel/helper-string-parser@7.25.9(transitive)
+ Added@babel/helper-validator-identifier@7.25.9(transitive)
+ Added@babel/parser@7.26.2(transitive)
+ Added@babel/template@7.25.9(transitive)
+ Added@babel/traverse@7.25.9(transitive)
+ Added@babel/types@7.26.0(transitive)
+ Added@jridgewell/gen-mapping@0.3.5(transitive)
+ Added@jridgewell/resolve-uri@3.1.2(transitive)
+ Added@jridgewell/set-array@1.2.1(transitive)
+ Added@jridgewell/sourcemap-codec@1.5.0(transitive)
+ Added@jridgewell/trace-mapping@0.3.25(transitive)
+ Addedansi-regex@4.1.1(transitive)
+ Addedansi-styles@3.2.1(transitive)
+ Addedappend-transform@1.0.0(transitive)
+ Addedarchy@1.0.0(transitive)
+ Addedargparse@1.0.10(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedcaching-transform@3.0.2(transitive)
+ Addedcamelcase@5.3.1(transitive)
+ Addedcliui@5.0.0(transitive)
+ Addedcolor-convert@1.9.3(transitive)
+ Addedcolor-name@1.1.3(transitive)
+ Addedcolors@1.3.3(transitive)
+ Addedcommondir@1.0.1(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedconvert-source-map@1.9.0(transitive)
+ Addedcp-file@6.2.0(transitive)
+ Addedcross-spawn@4.0.2(transitive)
+ Addeddebug@4.3.7(transitive)
+ Addeddecamelize@1.2.0(transitive)
+ Addeddefault-require-extensions@2.0.0(transitive)
+ Addedemoji-regex@7.0.3(transitive)
+ Addederror-ex@1.3.2(transitive)
+ Addedes6-error@4.1.1(transitive)
+ Addedesprima@4.0.1(transitive)
+ Addedfind-cache-dir@2.1.0(transitive)
+ Addedfind-up@3.0.0(transitive)
+ Addedforeground-child@1.5.6(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-caller-file@2.0.5(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedglobals@11.12.0(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedhas-flag@3.0.0(transitive)
+ Addedhasha@3.0.0(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedhosted-git-info@2.8.9(transitive)
+ Addedhtml-escaper@2.0.2(transitive)
+ Addedimurmurhash@0.1.4(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedis-arrayish@0.2.1(transitive)
+ Addedis-core-module@2.15.1(transitive)
+ Addedis-fullwidth-code-point@2.0.0(transitive)
+ Addedis-stream@1.1.0(transitive)
+ Addedisexe@2.0.0(transitive)
+ Addedistanbul-lib-coverage@2.0.5(transitive)
+ Addedistanbul-lib-hook@2.0.7(transitive)
+ Addedistanbul-lib-instrument@3.3.0(transitive)
+ Addedistanbul-lib-report@2.0.8(transitive)
+ Addedistanbul-lib-source-maps@3.0.6(transitive)
+ Addedistanbul-reports@2.2.7(transitive)
+ Addedjs-tokens@4.0.0(transitive)
+ Addedjs-yaml@3.14.1(transitive)
+ Addedjsesc@3.0.2(transitive)
+ Addedjson-parse-better-errors@1.0.2(transitive)
+ Addedload-json-file@4.0.0(transitive)
+ Addedlocate-path@3.0.0(transitive)
+ Addedlodash.flattendeep@4.4.0(transitive)
+ Addedlru-cache@4.1.5(transitive)
+ Addedmake-dir@2.1.0(transitive)
+ Addedmerge-source-map@1.1.0(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedms@2.1.3(transitive)
+ Addednested-error-stacks@2.1.1(transitive)
+ Addednormalize-package-data@2.5.0(transitive)
+ Addednyc@14.1.1(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedos-homedir@1.0.2(transitive)
+ Addedp-limit@2.3.0(transitive)
+ Addedp-locate@3.0.0(transitive)
+ Addedp-try@2.2.0(transitive)
+ Addedpackage-hash@3.0.0(transitive)
+ Addedparse-json@4.0.0(transitive)
+ Addedpath-exists@3.0.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedpath-parse@1.0.7(transitive)
+ Addedpath-type@3.0.0(transitive)
+ Addedpicocolors@1.1.1(transitive)
+ Addedpify@3.0.04.0.1(transitive)
+ Addedpkg-dir@3.0.0(transitive)
+ Addedpseudomap@1.0.2(transitive)
+ Addedread-pkg@3.0.0(transitive)
+ Addedread-pkg-up@4.0.0(transitive)
+ Addedrelease-zalgo@1.0.0(transitive)
+ Addedrequire-directory@2.1.1(transitive)
+ Addedrequire-main-filename@2.0.0(transitive)
+ Addedresolve@1.22.8(transitive)
+ Addedresolve-from@4.0.0(transitive)
+ Addedrimraf@2.7.1(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedsemver@5.7.26.3.1(transitive)
+ Addedset-blocking@2.0.0(transitive)
+ Addedsignal-exit@3.0.7(transitive)
+ Addedsource-map@0.6.1(transitive)
+ Addedspawn-wrap@1.4.3(transitive)
+ Addedspdx-correct@3.2.0(transitive)
+ Addedspdx-exceptions@2.5.0(transitive)
+ Addedspdx-expression-parse@3.0.1(transitive)
+ Addedspdx-license-ids@3.0.20(transitive)
+ Addedsprintf-js@1.0.3(transitive)
+ Addedstring-width@3.1.0(transitive)
+ Addedstrip-ansi@5.2.0(transitive)
+ Addedstrip-bom@3.0.0(transitive)
+ Addedsupports-color@6.1.0(transitive)
+ Addedsupports-preserve-symlinks-flag@1.0.0(transitive)
+ Addedtest-exclude@5.2.3(transitive)
+ Addedtracer@0.9.9(transitive)
+ Addeduuid@3.4.0(transitive)
+ Addedvalidate-npm-package-license@3.0.4(transitive)
+ Addedwhich@1.3.1(transitive)
+ Addedwhich-module@2.0.1(transitive)
+ Addedwrap-ansi@5.1.0(transitive)
+ Addedwrappy@1.0.2(transitive)
+ Addedwrite-file-atomic@2.4.3(transitive)
+ Addedy18n@4.0.3(transitive)
+ Addedyallist@2.1.2(transitive)
+ Addedyargs@13.3.2(transitive)
+ Addedyargs-parser@13.1.2(transitive)
- Removedcolors@1.2.3(transitive)
- Removedtracer@0.8.15(transitive)
Updatedtracer@^0.9.1