@xylabs/log
Advanced tools
Comparing version 2.6.16 to 2.7.0
@@ -29,2 +29,8 @@ "use strict"; | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
debug(...params) { | ||
if (this.devMode) { | ||
console.debug(params); | ||
} | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
error(...params) { | ||
@@ -38,10 +44,2 @@ var _a; | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
warn(...params) { | ||
var _a; | ||
console.warn(params); | ||
if (!this.devMode) { | ||
(_a = this.rollbar) === null || _a === void 0 ? void 0 : _a.warn(params); | ||
} | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
info(...params) { | ||
@@ -53,11 +51,13 @@ if (this.devMode) { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
debug(...params) { | ||
log(...params) { | ||
if (this.devMode) { | ||
console.debug(params); | ||
console.log(params); | ||
} | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
log(...params) { | ||
if (this.devMode) { | ||
console.log(params); | ||
warn(...params) { | ||
var _a; | ||
console.warn(params); | ||
if (!this.devMode) { | ||
(_a = this.rollbar) === null || _a === void 0 ? void 0 : _a.warn(params); | ||
} | ||
@@ -64,0 +64,0 @@ } |
@@ -27,3 +27,3 @@ { | ||
"character": 2, | ||
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/log/src/Log.ts#L14" | ||
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/log/src/Log.ts#L14" | ||
} | ||
@@ -61,3 +61,3 @@ ], | ||
{ | ||
"id": 11, | ||
"id": 10, | ||
"name": "devMode", | ||
@@ -73,5 +73,5 @@ "kind": 1024, | ||
"fileName": "Log.ts", | ||
"line": 12, | ||
"line": 11, | ||
"character": 10, | ||
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/log/src/Log.ts#L12" | ||
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/log/src/Log.ts#L11" | ||
} | ||
@@ -85,3 +85,3 @@ ], | ||
{ | ||
"id": 10, | ||
"id": 11, | ||
"name": "rollbar", | ||
@@ -97,5 +97,5 @@ "kind": 1024, | ||
"fileName": "Log.ts", | ||
"line": 11, | ||
"line": 12, | ||
"character": 10, | ||
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/log/src/Log.ts#L11" | ||
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/log/src/Log.ts#L12" | ||
} | ||
@@ -111,3 +111,3 @@ ], | ||
{ | ||
"id": 21, | ||
"id": 12, | ||
"name": "debug", | ||
@@ -122,5 +122,5 @@ "kind": 2048, | ||
"fileName": "Log.ts", | ||
"line": 66, | ||
"line": 43, | ||
"character": 9, | ||
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/log/src/Log.ts#L66" | ||
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/log/src/Log.ts#L43" | ||
} | ||
@@ -130,3 +130,3 @@ ], | ||
{ | ||
"id": 22, | ||
"id": 13, | ||
"name": "debug", | ||
@@ -138,3 +138,3 @@ "kind": 4096, | ||
{ | ||
"id": 23, | ||
"id": 14, | ||
"name": "params", | ||
@@ -163,3 +163,3 @@ "kind": 32768, | ||
{ | ||
"id": 12, | ||
"id": 15, | ||
"name": "error", | ||
@@ -174,5 +174,5 @@ "kind": 2048, | ||
"fileName": "Log.ts", | ||
"line": 43, | ||
"line": 50, | ||
"character": 9, | ||
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/log/src/Log.ts#L43" | ||
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/log/src/Log.ts#L50" | ||
} | ||
@@ -182,3 +182,3 @@ ], | ||
{ | ||
"id": 13, | ||
"id": 16, | ||
"name": "error", | ||
@@ -190,3 +190,3 @@ "kind": 4096, | ||
{ | ||
"id": 14, | ||
"id": 17, | ||
"name": "params", | ||
@@ -225,5 +225,5 @@ "kind": 32768, | ||
"fileName": "Log.ts", | ||
"line": 59, | ||
"line": 58, | ||
"character": 9, | ||
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/log/src/Log.ts#L59" | ||
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/log/src/Log.ts#L58" | ||
} | ||
@@ -264,3 +264,3 @@ ], | ||
{ | ||
"id": 24, | ||
"id": 21, | ||
"name": "log", | ||
@@ -275,5 +275,5 @@ "kind": 2048, | ||
"fileName": "Log.ts", | ||
"line": 73, | ||
"line": 65, | ||
"character": 9, | ||
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/log/src/Log.ts#L73" | ||
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/log/src/Log.ts#L65" | ||
} | ||
@@ -283,3 +283,3 @@ ], | ||
{ | ||
"id": 25, | ||
"id": 22, | ||
"name": "log", | ||
@@ -291,3 +291,3 @@ "kind": 4096, | ||
{ | ||
"id": 26, | ||
"id": 23, | ||
"name": "params", | ||
@@ -316,3 +316,3 @@ "kind": 32768, | ||
{ | ||
"id": 15, | ||
"id": 24, | ||
"name": "warn", | ||
@@ -327,5 +327,5 @@ "kind": 2048, | ||
"fileName": "Log.ts", | ||
"line": 51, | ||
"line": 72, | ||
"character": 9, | ||
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/log/src/Log.ts#L51" | ||
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/log/src/Log.ts#L72" | ||
} | ||
@@ -335,3 +335,3 @@ ], | ||
{ | ||
"id": 16, | ||
"id": 25, | ||
"name": "warn", | ||
@@ -343,3 +343,3 @@ "kind": 4096, | ||
{ | ||
"id": 17, | ||
"id": 26, | ||
"name": "params", | ||
@@ -378,4 +378,4 @@ "kind": 32768, | ||
"children": [ | ||
11, | ||
10 | ||
10, | ||
11 | ||
] | ||
@@ -386,7 +386,7 @@ }, | ||
"children": [ | ||
21, | ||
12, | ||
15, | ||
18, | ||
24, | ||
15 | ||
21, | ||
24 | ||
] | ||
@@ -400,3 +400,3 @@ } | ||
"character": 13, | ||
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/log/src/Log.ts#L10" | ||
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/log/src/Log.ts#L10" | ||
} | ||
@@ -425,3 +425,3 @@ ] | ||
"character": 2, | ||
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/log/src/Log.ts#L4" | ||
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/log/src/Log.ts#L4" | ||
} | ||
@@ -447,3 +447,3 @@ ], | ||
"character": 2, | ||
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/log/src/Log.ts#L5" | ||
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/log/src/Log.ts#L5" | ||
} | ||
@@ -457,3 +457,3 @@ ], | ||
{ | ||
"id": 5, | ||
"id": 4, | ||
"name": "payload", | ||
@@ -468,5 +468,5 @@ "kind": 1024, | ||
"fileName": "Log.ts", | ||
"line": 7, | ||
"line": 6, | ||
"character": 2, | ||
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/log/src/Log.ts#L7" | ||
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/log/src/Log.ts#L6" | ||
} | ||
@@ -492,3 +492,3 @@ ], | ||
{ | ||
"id": 4, | ||
"id": 5, | ||
"name": "rollbarToken", | ||
@@ -503,5 +503,5 @@ "kind": 1024, | ||
"fileName": "Log.ts", | ||
"line": 6, | ||
"line": 7, | ||
"character": 2, | ||
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/log/src/Log.ts#L6" | ||
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/log/src/Log.ts#L7" | ||
} | ||
@@ -521,4 +521,4 @@ ], | ||
3, | ||
5, | ||
4 | ||
4, | ||
5 | ||
] | ||
@@ -532,3 +532,3 @@ } | ||
"character": 17, | ||
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/log/src/Log.ts#L3" | ||
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/log/src/Log.ts#L3" | ||
} | ||
@@ -557,5 +557,5 @@ ] | ||
"character": 0, | ||
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/log/src/index.ts#L1" | ||
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/log/src/index.ts#L1" | ||
} | ||
] | ||
} |
import Rollbar from 'rollbar'; | ||
export class Log { | ||
devMode; | ||
rollbar; | ||
devMode; | ||
constructor(config) { | ||
@@ -32,2 +32,8 @@ this.devMode = config.devMode ?? false; | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
debug(...params) { | ||
if (this.devMode) { | ||
console.debug(params); | ||
} | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
error(...params) { | ||
@@ -40,9 +46,2 @@ console.error(params); | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
warn(...params) { | ||
console.warn(params); | ||
if (!this.devMode) { | ||
this.rollbar?.warn(params); | ||
} | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
info(...params) { | ||
@@ -54,11 +53,12 @@ if (this.devMode) { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
debug(...params) { | ||
log(...params) { | ||
if (this.devMode) { | ||
console.debug(params); | ||
console.log(params); | ||
} | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
log(...params) { | ||
if (this.devMode) { | ||
console.log(params); | ||
warn(...params) { | ||
console.warn(params); | ||
if (!this.devMode) { | ||
this.rollbar?.warn(params); | ||
} | ||
@@ -65,0 +65,0 @@ } |
export interface LogConfig { | ||
commitHash?: string; | ||
devMode?: boolean; | ||
payload?: Record<string, unknown>; | ||
rollbarToken?: string; | ||
payload?: Record<string, unknown>; | ||
} | ||
export declare class Log { | ||
private devMode?; | ||
private rollbar?; | ||
private devMode?; | ||
constructor(config: LogConfig); | ||
debug(...params: any[]): void; | ||
error(...params: any[]): void; | ||
warn(...params: any[]): void; | ||
info(...params: any[]): void; | ||
debug(...params: any[]): void; | ||
log(...params: any[]): void; | ||
warn(...params: any[]): void; | ||
} | ||
//# sourceMappingURL=Log.d.ts.map |
@@ -50,5 +50,5 @@ { | ||
"devDependencies": { | ||
"@xylabs/eslint-config": "2.12.23", | ||
"@xylabs/ts-scripts-yarn3": "^2.12.23", | ||
"eslint": "^8.32.0" | ||
"@xylabs/eslint-config": "2.13.11", | ||
"@xylabs/ts-scripts-yarn3": "^2.13.11", | ||
"eslint": "^8.33.0" | ||
}, | ||
@@ -63,4 +63,4 @@ "publishConfig": { | ||
"sideEffects": false, | ||
"version": "2.6.16", | ||
"version": "2.7.0", | ||
"packageManager": "yarn@3.3.1" | ||
} |
@@ -6,9 +6,9 @@ import Rollbar from 'rollbar' | ||
devMode?: boolean | ||
payload?: Record<string, unknown> | ||
rollbarToken?: string | ||
payload?: Record<string, unknown> | ||
} | ||
export class Log { | ||
private devMode?: boolean | ||
private rollbar?: Rollbar | ||
private devMode?: boolean | ||
@@ -44,6 +44,5 @@ constructor(config: LogConfig) { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
public error(...params: any[]) { | ||
console.error(params) | ||
if (!this.devMode) { | ||
this.rollbar?.error(params) | ||
public debug(...params: any[]) { | ||
if (this.devMode) { | ||
console.debug(params) | ||
} | ||
@@ -53,6 +52,6 @@ } | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
public warn(...params: any[]) { | ||
console.warn(params) | ||
public error(...params: any[]) { | ||
console.error(params) | ||
if (!this.devMode) { | ||
this.rollbar?.warn(params) | ||
this.rollbar?.error(params) | ||
} | ||
@@ -69,5 +68,5 @@ } | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
public debug(...params: any[]) { | ||
public log(...params: any[]) { | ||
if (this.devMode) { | ||
console.debug(params) | ||
console.log(params) | ||
} | ||
@@ -77,7 +76,8 @@ } | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
public log(...params: any[]) { | ||
if (this.devMode) { | ||
console.log(params) | ||
public warn(...params: any[]) { | ||
console.warn(params) | ||
if (!this.devMode) { | ||
this.rollbar?.warn(params) | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
34332