@equinor/fusion-framework-module
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -6,2 +6,11 @@ # Change Log | ||
## [1.1.0](https://github.com/equinor/fusion-framework/compare/@equinor/fusion-framework-module@1.0.1...@equinor/fusion-framework-module@1.1.0) (2022-09-13) | ||
### Features | ||
* **module:** allow setting log levels ([017b5b3](https://github.com/equinor/fusion-framework/commit/017b5b34645aa001297f37e7aef5557e9027beee)) | ||
## [1.0.1](https://github.com/equinor/fusion-framework/compare/@equinor/fusion-framework-module@1.0.1-next.1...@equinor/fusion-framework-module@1.0.1) (2022-09-12) | ||
@@ -8,0 +17,0 @@ |
export class ConsoleLogger { | ||
domain; | ||
level = 1; | ||
constructor(domain) { | ||
@@ -16,12 +17,14 @@ this.domain = domain; | ||
debug(...msg) { | ||
process.env.NODE_ENV === 'development' && console.debug(...this._createMessage(msg)); | ||
if (process.env.NODE_ENV === 'development') { | ||
this.level > 3 && console.debug(...this._createMessage(msg)); | ||
} | ||
} | ||
info(...msg) { | ||
console.info(...this._createMessage(msg)); | ||
this.level > 2 && console.info(...this._createMessage(msg)); | ||
} | ||
warn(...msg) { | ||
console.warn(...this._createMessage(msg)); | ||
this.level > 1 && console.warn(...this._createMessage(msg)); | ||
} | ||
error(...msg) { | ||
console.error(...this._createMessage(msg)); | ||
this.level > 0 && console.error(...this._createMessage(msg)); | ||
} | ||
@@ -28,0 +31,0 @@ } |
import { AnyModule } from './types'; | ||
export declare class ConsoleLogger { | ||
protected domain: string; | ||
level: 0 | 1 | 2 | 3 | 4; | ||
constructor(domain: string); | ||
@@ -5,0 +6,0 @@ protected _createMessage(msg: unknown[]): unknown[]; |
{ | ||
"name": "@equinor/fusion-framework-module", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "", | ||
@@ -31,3 +31,3 @@ "main": "dist/esm/index.js", | ||
}, | ||
"gitHead": "92331edc3d412391fbb33d322e7cf8769b57534e" | ||
"gitHead": "e4865f46e0e01bb8efdbe0a542e052255ec570a8" | ||
} |
import { AnyModule } from './types'; | ||
export class ConsoleLogger { | ||
/** - 0-1-2-3 (error-warning-info-debug) if not provided only errors are logged */ | ||
public level: 0 | 1 | 2 | 3 | 4 = 1; | ||
constructor(protected domain: string) {} | ||
@@ -18,12 +20,14 @@ | ||
debug(...msg: unknown[]) { | ||
process.env.NODE_ENV === 'development' && console.debug(...this._createMessage(msg)); | ||
if (process.env.NODE_ENV === 'development') { | ||
this.level > 3 && console.debug(...this._createMessage(msg)); | ||
} | ||
} | ||
info(...msg: unknown[]) { | ||
console.info(...this._createMessage(msg)); | ||
this.level > 2 && console.info(...this._createMessage(msg)); | ||
} | ||
warn(...msg: unknown[]) { | ||
console.warn(...this._createMessage(msg)); | ||
this.level > 1 && console.warn(...this._createMessage(msg)); | ||
} | ||
error(...msg: unknown[]) { | ||
console.error(...this._createMessage(msg)); | ||
this.level > 0 && console.error(...this._createMessage(msg)); | ||
} | ||
@@ -30,0 +34,0 @@ } |
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
115261
778