koishi-utils
Advanced tools
Comparing version 3.0.3 to 3.1.0
@@ -13,3 +13,2 @@ /// <reference types="node" /> | ||
static formatters: Record<string, (this: Logger, value: any) => string>; | ||
static create(name?: string, showDiff?: boolean): Logger; | ||
static color(code: number, value: any, decoration?: string): string; | ||
@@ -23,3 +22,3 @@ private code; | ||
debug: LogFunction; | ||
private constructor(); | ||
constructor(name: string, showDiff?: boolean); | ||
private color; | ||
@@ -26,0 +25,0 @@ private createMethod; |
@@ -20,3 +20,3 @@ "use strict"; | ||
this.extend = (namespace) => { | ||
return Logger.create(`${this.name}:${namespace}`); | ||
return new Logger(`${this.name}:${namespace}`); | ||
}; | ||
@@ -52,2 +52,4 @@ this.format = (...args) => { | ||
}; | ||
if (name in instances) | ||
return instances[name]; | ||
let hash = 0; | ||
@@ -67,8 +69,2 @@ for (let i = 0; i < name.length; i++) { | ||
} | ||
static create(name = '', showDiff = false) { | ||
const logger = instances[name] || new Logger(name); | ||
if (showDiff !== undefined) | ||
logger.showDiff = showDiff; | ||
return logger; | ||
} | ||
static color(code, value, decoration = '') { | ||
@@ -75,0 +71,0 @@ if (!Logger.options.colors) |
@@ -7,3 +7,3 @@ "use strict"; | ||
const logger_1 = require("./logger"); | ||
const logger = logger_1.Logger.create('observer'); | ||
const logger = new logger_1.Logger('observer'); | ||
const staticTypes = ['number', 'string', 'bigint', 'boolean', 'symbol', 'function']; | ||
@@ -10,0 +10,0 @@ const builtinClasses = ['Date', 'RegExp', 'Set', 'Map', 'WeakSet', 'WeakMap', 'Array']; |
{ | ||
"name": "koishi-utils", | ||
"description": "Utilities for Koishi", | ||
"version": "3.0.3", | ||
"version": "3.1.0", | ||
"main": "dist/index.js", | ||
@@ -12,3 +12,3 @@ "typings": "dist/index.d.ts", | ||
"author": "Shigma <1700011071@pku.edu.cn>", | ||
"license": "LGPL-3.0-or-later", | ||
"license": "MIT", | ||
"scripts": { | ||
@@ -15,0 +15,0 @@ "lint": "eslint src --ext .ts", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Copyleft License
License(Experimental) Copyleft license information was found.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
0
100
76890
870