Socket
Socket
Sign inDemoInstall

@thi.ng/api

Package Overview
Dependencies
Maintainers
1
Versions
186
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thi.ng/api - npm Package Compare versions

Comparing version 6.0.1 to 6.1.0

logger.d.ts

19

api.d.ts

@@ -135,2 +135,10 @@ export declare const DEFAULT_EPS = 0.000001;

export declare type Watch<T> = (id: string, oldState: T, newState: T) => void;
export declare const enum LogLevel {
FINE = 0,
DEBUG = 1,
INFO = 2,
WARN = 3,
SEVERE = 4,
NONE = 5
}
/**

@@ -353,2 +361,13 @@ * @param K key type

}
export interface ILogger {
/**
* This logger's configured minimum log level
*/
level: LogLevel;
fine(...args: any[]): void;
debug(...args: any[]): void;
info(...args: any[]): void;
warn(...args: any[]): void;
severe(...args: any[]): void;
}
/**

@@ -355,0 +374,0 @@ * Generic interface for types supporting metadata. Implementations MUST

@@ -13,1 +13,10 @@ export const DEFAULT_EPS = 1e-6;

export const NO_OP = () => { };
export var LogLevel;
(function (LogLevel) {
LogLevel[LogLevel["FINE"] = 0] = "FINE";
LogLevel[LogLevel["DEBUG"] = 1] = "DEBUG";
LogLevel[LogLevel["INFO"] = 2] = "INFO";
LogLevel[LogLevel["WARN"] = 3] = "WARN";
LogLevel[LogLevel["SEVERE"] = 4] = "SEVERE";
LogLevel[LogLevel["NONE"] = 5] = "NONE";
})(LogLevel || (LogLevel = {}));

@@ -6,2 +6,14 @@ # Change Log

# [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)
### Features
* **api:** add common logging types & default impls ([4578604](https://github.com/thi-ng/umbrella/commit/4578604))
* **api:** update ILogger, freeze NULL_LOGGER ([27ff8de](https://github.com/thi-ng/umbrella/commit/27ff8de))
## [6.0.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@6.0.0...@thi.ng/api@6.0.1) (2019-04-02)

@@ -8,0 +20,0 @@

1

index.d.ts
export * from "./api";
export * from "./assert";
export * from "./logger";
export * from "./mixin";

@@ -4,0 +5,0 @@ export * from "./decorators/configurable";

export * from "./api";
export * from "./assert";
export * from "./logger";
export * from "./mixin";

@@ -4,0 +5,0 @@ export * from "./decorators/configurable";

@@ -13,2 +13,10 @@ 'use strict';

const NO_OP = () => { };
(function (LogLevel) {
LogLevel[LogLevel["FINE"] = 0] = "FINE";
LogLevel[LogLevel["DEBUG"] = 1] = "DEBUG";
LogLevel[LogLevel["INFO"] = 2] = "INFO";
LogLevel[LogLevel["WARN"] = 3] = "WARN";
LogLevel[LogLevel["SEVERE"] = 4] = "SEVERE";
LogLevel[LogLevel["NONE"] = 5] = "NONE";
})(exports.LogLevel || (exports.LogLevel = {}));

@@ -25,2 +33,35 @@ const assert = typeof process === "undefined" ||

const NULL_LOGGER = Object.freeze({
level: 5 ,
fine() { },
debug() { },
info() { },
warn() { },
severe() { }
});
class ConsoleLogger {
constructor(id, level = 0 ) {
this.id = id;
this.level = level;
}
fine(...args) {
this.level <= 0 && this.log("FINE", args);
}
debug(...args) {
this.level <= 1 && this.log("DEBUG", args);
}
info(...args) {
this.level <= 2 && this.log("INFO", args);
}
warn(...args) {
this.level <= 3 && this.log("WARN", args);
}
severe(...args) {
this.level <= 4 && this.log("SEVERE", args);
}
log(level, args) {
console.info(`[${level}][${this.id}]`, ...args);
}
}
const mixin = (behaviour, sharedBehaviour = {}) => {

@@ -196,2 +237,3 @@ const instanceKeys = Reflect.ownKeys(behaviour);

exports.ConsoleLogger = ConsoleLogger;
exports.DEFAULT_EPS = DEFAULT_EPS;

@@ -205,2 +247,3 @@ exports.EVENT_ALL = EVENT_ALL;

exports.NO_OP = NO_OP;
exports.NULL_LOGGER = NULL_LOGGER;
exports.SEMAPHORE = SEMAPHORE;

@@ -207,0 +250,0 @@ exports.assert = assert;

@@ -13,2 +13,10 @@ (function (global, factory) {

const NO_OP = () => { };
(function (LogLevel) {
LogLevel[LogLevel["FINE"] = 0] = "FINE";
LogLevel[LogLevel["DEBUG"] = 1] = "DEBUG";
LogLevel[LogLevel["INFO"] = 2] = "INFO";
LogLevel[LogLevel["WARN"] = 3] = "WARN";
LogLevel[LogLevel["SEVERE"] = 4] = "SEVERE";
LogLevel[LogLevel["NONE"] = 5] = "NONE";
})(exports.LogLevel || (exports.LogLevel = {}));

@@ -25,2 +33,35 @@ const assert = typeof process === "undefined" ||

const NULL_LOGGER = Object.freeze({
level: 5 ,
fine() { },
debug() { },
info() { },
warn() { },
severe() { }
});
class ConsoleLogger {
constructor(id, level = 0 ) {
this.id = id;
this.level = level;
}
fine(...args) {
this.level <= 0 && this.log("FINE", args);
}
debug(...args) {
this.level <= 1 && this.log("DEBUG", args);
}
info(...args) {
this.level <= 2 && this.log("INFO", args);
}
warn(...args) {
this.level <= 3 && this.log("WARN", args);
}
severe(...args) {
this.level <= 4 && this.log("SEVERE", args);
}
log(level, args) {
console.info(`[${level}][${this.id}]`, ...args);
}
}
const mixin = (behaviour, sharedBehaviour = {}) => {

@@ -196,2 +237,3 @@ const instanceKeys = Reflect.ownKeys(behaviour);

exports.ConsoleLogger = ConsoleLogger;
exports.DEFAULT_EPS = DEFAULT_EPS;

@@ -205,2 +247,3 @@ exports.EVENT_ALL = EVENT_ALL;

exports.NO_OP = NO_OP;
exports.NULL_LOGGER = NULL_LOGGER;
exports.SEMAPHORE = SEMAPHORE;

@@ -207,0 +250,0 @@ exports.assert = assert;

14

package.json
{
"name": "@thi.ng/api",
"version": "6.0.1",
"version": "6.1.0",
"description": "Common, generic types & interfaces for thi.ng projects",

@@ -28,10 +28,10 @@ "module": "./index.js",

"@types/mocha": "^5.2.6",
"@types/node": "^11.13.0",
"mocha": "^6.0.2",
"nyc": "^13.3.0",
"@types/node": "^11.13.7",
"mocha": "^6.1.4",
"nyc": "^14.0.0",
"typedoc": "^0.14.2",
"typescript": "^3.4.1"
"typescript": "^3.4.5"
},
"dependencies": {
"@thi.ng/errors": "^1.0.5"
"@thi.ng/errors": "^1.0.6"
},

@@ -59,3 +59,3 @@ "keywords": [

"sideEffects": false,
"gitHead": "8982b253961afbee2a63135c4ed7153c61febefb"
"gitHead": "38b2c61a9a7c1344889b81cd6eb3dcd601ceb443"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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