@kitql/helper
Advanced tools
Comparing version 0.1.3 to 0.1.4
22
index.js
@@ -5,6 +5,2 @@ 'use strict'; | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
const pino = _interopDefault(require('pino')); | ||
function logGreen(str) { | ||
@@ -23,22 +19,10 @@ return `\x1b[32m${str}\x1b[37m\x1b[0m`; | ||
class Log { | ||
constructor(toolName, options = null) { | ||
const { sync = false, withTime = false, withlevelKey = true } = options !== null && options !== void 0 ? options : {}; | ||
constructor(toolName) { | ||
this.toolName = toolName; | ||
this.logger = pino({ | ||
transport: { | ||
target: 'pino-pretty', | ||
options: { | ||
colorize: false, | ||
sync, | ||
translateTime: withTime ? true : false, | ||
ignore: `pid,hostname${withTime ? '' : ',time'}${withlevelKey ? '' : ',level'}` | ||
} | ||
} | ||
}); | ||
} | ||
info(msg) { | ||
this.logger.info(`${logMagneta(`[${this.toolName}]`)} - ${msg}`); | ||
console.info(`${logMagneta(`[${this.toolName}]`)} ${msg}`); | ||
} | ||
error(msg) { | ||
this.logger.error(`${logMagneta(`[${this.toolName}]`)} - ${msg}`); | ||
console.error(`${logMagneta(`[${this.toolName}]`)}${logRed(`[E]`)} ${msg}`); | ||
} | ||
@@ -45,0 +29,0 @@ } |
@@ -5,13 +5,8 @@ export declare function logGreen(str: string): string; | ||
export declare function logCyan(str: string): string; | ||
export declare type Options = { | ||
sync?: boolean | null; | ||
withTime?: boolean | null; | ||
withlevelKey?: boolean | null; | ||
}; | ||
export declare function logYellow(str: string): string; | ||
export declare class Log { | ||
private toolName; | ||
private logger; | ||
constructor(toolName: string, options?: Options | null); | ||
constructor(toolName: string); | ||
info(msg: string): void; | ||
error(msg: string): void; | ||
} |
{ | ||
"name": "@kitql/helper", | ||
"version": "0.1.3", | ||
"dependencies": { | ||
"pino": "7.8.0", | ||
"pino-pretty": "7.5.1" | ||
}, | ||
"version": "0.1.4", | ||
"repository": { | ||
@@ -9,0 +5,0 @@ "type": "git", |
Sorry, the diff of this file is not supported yet
0
4650
138
- Removedpino@7.8.0
- Removedpino-pretty@7.5.1
- Removedansi-styles@3.2.1(transitive)
- Removedargs@5.0.3(transitive)
- Removedatomic-sleep@1.0.0(transitive)
- Removedcamelcase@5.0.0(transitive)
- Removedchalk@2.4.2(transitive)
- Removedcolor-convert@1.9.3(transitive)
- Removedcolor-name@1.1.3(transitive)
- Removedcolorette@2.0.20(transitive)
- Removeddateformat@4.6.3(transitive)
- Removedend-of-stream@1.4.4(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedfast-redact@3.5.0(transitive)
- Removedfast-safe-stringify@2.1.1(transitive)
- Removedhas-flag@3.0.0(transitive)
- Removedinherits@2.0.4(transitive)
- Removedjoycon@3.1.1(transitive)
- Removedleven@2.1.0(transitive)
- Removedmri@1.1.4(transitive)
- Removedon-exit-leak-free@0.2.0(transitive)
- Removedonce@1.4.0(transitive)
- Removedpino@7.8.0(transitive)
- Removedpino-pretty@7.5.1(transitive)
- Removedpino-std-serializers@4.0.0(transitive)
- Removedprocess-warning@1.0.0(transitive)
- Removedpump@3.0.2(transitive)
- Removedquick-format-unescaped@4.0.4(transitive)
- Removedreadable-stream@3.6.2(transitive)
- Removedreal-require@0.1.0(transitive)
- Removedrfdc@1.4.1(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsafe-stable-stringify@2.5.0(transitive)
- Removedsecure-json-parse@2.7.0(transitive)
- Removedsonic-boom@2.8.0(transitive)
- Removedstring_decoder@1.3.0(transitive)
- Removedstrip-json-comments@3.1.1(transitive)
- Removedsupports-color@5.5.0(transitive)
- Removedthread-stream@0.13.2(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removedwrappy@1.0.2(transitive)