@thi.ng/api
Advanced tools
Comparing version 6.1.0 to 6.1.1
@@ -135,3 +135,3 @@ export declare const DEFAULT_EPS = 0.000001; | ||
export declare type Watch<T> = (id: string, oldState: T, newState: T) => void; | ||
export declare const enum LogLevel { | ||
export declare enum LogLevel { | ||
FINE = 0, | ||
@@ -138,0 +138,0 @@ DEBUG = 1, |
@@ -6,2 +6,13 @@ # Change Log | ||
## [6.1.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@6.1.0...@thi.ng/api@6.1.1) (2019-04-26) | ||
### Bug Fixes | ||
* **api:** make LogLevel non-const enum, minor fix ConsoleLogger ([88d5e9d](https://github.com/thi-ng/umbrella/commit/88d5e9d)) | ||
# [6.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@6.0.1...@thi.ng/api@6.1.0) (2019-04-24) | ||
@@ -8,0 +19,0 @@ |
@@ -33,3 +33,3 @@ 'use strict'; | ||
const NULL_LOGGER = Object.freeze({ | ||
level: 5 , | ||
level: exports.LogLevel.NONE, | ||
fine() { }, | ||
@@ -42,3 +42,3 @@ debug() { }, | ||
class ConsoleLogger { | ||
constructor(id, level = 0 ) { | ||
constructor(id, level = exports.LogLevel.FINE) { | ||
this.id = id; | ||
@@ -48,18 +48,18 @@ this.level = level; | ||
fine(...args) { | ||
this.level <= 0 && this.log("FINE", args); | ||
this.level <= exports.LogLevel.FINE && this.log("FINE", args); | ||
} | ||
debug(...args) { | ||
this.level <= 1 && this.log("DEBUG", args); | ||
this.level <= exports.LogLevel.DEBUG && this.log("DEBUG", args); | ||
} | ||
info(...args) { | ||
this.level <= 2 && this.log("INFO", args); | ||
this.level <= exports.LogLevel.INFO && this.log("INFO", args); | ||
} | ||
warn(...args) { | ||
this.level <= 3 && this.log("WARN", args); | ||
this.level <= exports.LogLevel.WARN && this.log("WARN", args); | ||
} | ||
severe(...args) { | ||
this.level <= 4 && this.log("SEVERE", args); | ||
this.level <= exports.LogLevel.SEVERE && this.log("SEVERE", args); | ||
} | ||
log(level, args) { | ||
console.info(`[${level}][${this.id}]`, ...args); | ||
console.log(`[${level}] ${this.id}:`, ...args); | ||
} | ||
@@ -66,0 +66,0 @@ } |
@@ -33,3 +33,3 @@ (function (global, factory) { | ||
const NULL_LOGGER = Object.freeze({ | ||
level: 5 , | ||
level: exports.LogLevel.NONE, | ||
fine() { }, | ||
@@ -42,3 +42,3 @@ debug() { }, | ||
class ConsoleLogger { | ||
constructor(id, level = 0 ) { | ||
constructor(id, level = exports.LogLevel.FINE) { | ||
this.id = id; | ||
@@ -48,18 +48,18 @@ this.level = level; | ||
fine(...args) { | ||
this.level <= 0 && this.log("FINE", args); | ||
this.level <= exports.LogLevel.FINE && this.log("FINE", args); | ||
} | ||
debug(...args) { | ||
this.level <= 1 && this.log("DEBUG", args); | ||
this.level <= exports.LogLevel.DEBUG && this.log("DEBUG", args); | ||
} | ||
info(...args) { | ||
this.level <= 2 && this.log("INFO", args); | ||
this.level <= exports.LogLevel.INFO && this.log("INFO", args); | ||
} | ||
warn(...args) { | ||
this.level <= 3 && this.log("WARN", args); | ||
this.level <= exports.LogLevel.WARN && this.log("WARN", args); | ||
} | ||
severe(...args) { | ||
this.level <= 4 && this.log("SEVERE", args); | ||
this.level <= exports.LogLevel.SEVERE && this.log("SEVERE", args); | ||
} | ||
log(level, args) { | ||
console.info(`[${level}][${this.id}]`, ...args); | ||
console.log(`[${level}] ${this.id}:`, ...args); | ||
} | ||
@@ -66,0 +66,0 @@ } |
@@ -0,3 +1,4 @@ | ||
import { LogLevel } from "./api"; | ||
export const NULL_LOGGER = Object.freeze({ | ||
level: 5 /* NONE */, | ||
level: LogLevel.NONE, | ||
fine() { }, | ||
@@ -10,3 +11,3 @@ debug() { }, | ||
export class ConsoleLogger { | ||
constructor(id, level = 0 /* FINE */) { | ||
constructor(id, level = LogLevel.FINE) { | ||
this.id = id; | ||
@@ -16,19 +17,19 @@ this.level = level; | ||
fine(...args) { | ||
this.level <= 0 /* FINE */ && this.log("FINE", args); | ||
this.level <= LogLevel.FINE && this.log("FINE", args); | ||
} | ||
debug(...args) { | ||
this.level <= 1 /* DEBUG */ && this.log("DEBUG", args); | ||
this.level <= LogLevel.DEBUG && this.log("DEBUG", args); | ||
} | ||
info(...args) { | ||
this.level <= 2 /* INFO */ && this.log("INFO", args); | ||
this.level <= LogLevel.INFO && this.log("INFO", args); | ||
} | ||
warn(...args) { | ||
this.level <= 3 /* WARN */ && this.log("WARN", args); | ||
this.level <= LogLevel.WARN && this.log("WARN", args); | ||
} | ||
severe(...args) { | ||
this.level <= 4 /* SEVERE */ && this.log("SEVERE", args); | ||
this.level <= LogLevel.SEVERE && this.log("SEVERE", args); | ||
} | ||
log(level, args) { | ||
console.info(`[${level}][${this.id}]`, ...args); | ||
console.log(`[${level}] ${this.id}:`, ...args); | ||
} | ||
} |
{ | ||
"name": "@thi.ng/api", | ||
"version": "6.1.0", | ||
"version": "6.1.1", | ||
"description": "Common, generic types & interfaces for thi.ng projects", | ||
@@ -58,3 +58,3 @@ "module": "./index.js", | ||
"sideEffects": false, | ||
"gitHead": "38b2c61a9a7c1344889b81cd6eb3dcd601ceb443" | ||
"gitHead": "aaa7369a8bbc6c540f3bce5f0c203365fe1b7dd8" | ||
} |
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
79080
1338