brolog
Version:
Npmlog like logger for Browser
66 lines • 2.46 kB
TypeScript
/*!
* Brolog JavaScript Library v1.1.0
* https://github.com/huan/brolog
*
* Copyright Huan LI <zixia@zixia.net>
* Released under the ISC license
* https://github.com/huan/brolog/blob/master/LICENSE
*
* Date: 2016-07
*/
import { VERSION } from './config.js';
import type { Loggable } from './logger.js';
declare type LogLevelTitle = 'ERR' | 'WARN' | 'INFO' | 'VERB' | 'SILL';
declare type TextPrinterFunction = (title: string, text?: string) => void;
declare enum LogLevel {
silent = 0,
error = 1,
warn = 2,
info = 3,
verbose = 4,
silly = 5
}
declare type LogLevelName = keyof typeof LogLevel;
declare class Brolog implements Loggable {
private static globalInstance?;
private static globalLogLevelName;
private static globalPrefix;
private enableTimestamp;
private logLevel;
private prefixFilter?;
textPrinter: (levelTitle: LogLevelTitle, text: string) => void;
constructor();
/**
* Create a global Brolog Instance for sharing between modules
*/
static instance(levelName?: LogLevelName, prefix?: string | RegExp): Brolog;
static version(): string;
version(): string;
static enableLogging(printerFunc: boolean | TextPrinterFunction): Brolog;
enableLogging(printerFunc: boolean | TextPrinterFunction): Brolog;
static prefix(): RegExp;
static prefix(filter: string | RegExp): void;
prefix(): RegExp;
prefix(filter: string | RegExp): void;
static level(levelName?: LogLevelName): LogLevelName;
level(levelName?: LogLevelName): "info" | "silent" | "error" | "warn" | "verbose" | "silly";
private log;
defaultTextPrinter(levelTitle: LogLevelTitle, text: string): void;
static error(prefix: string, ...args: any[]): void;
error(prefix: string, ...args: any[]): void;
static warn(prefix: string, ...args: any[]): void;
warn(prefix: string, ...args: any[]): void;
static info(prefix: string, ...args: any[]): void;
info(prefix: string, ...args: any[]): void;
static verbose(prefix: string, ...args: any[]): void;
verbose(prefix: string, ...args: any[]): void;
static silly(prefix: string, ...args: any[]): void;
silly(prefix: string, ...args: any[]): void;
timestamp(enable: boolean): void;
timestamp(): string;
}
export { VERSION, };
declare const log: Brolog;
export type { LogLevelTitle, Loggable, LogLevelName, };
export { LogLevel, Brolog, log, };
//# sourceMappingURL=brolog.d.ts.map