Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

klg-logger

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

klg-logger - npm Package Compare versions

Comparing version 2.0.1-1 to 2.0.1

21

dist/Logger.d.ts
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;

4

dist/Logger.test.js

@@ -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)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc