node-jet
Version:
Jet Realtime Message Bus for the Web. Daemon and Peer implementation.
69 lines (68 loc) • 1.67 kB
TypeScript
export declare enum LogLevel {
'socket' = 1,
'debug' = 2,
'info' = 3,
'warn' = 4,
'error' = 5,
'none' = 6
}
type LogFunction = (...args: string[]) => void;
export interface logger {
logName: string;
logLevel?: LogLevel;
logFile?: string;
logCallbacks?: LogFunction[];
}
/**
* Logger class used for logging. Logging can be done to a file to the console or to any callback
*/
export declare class Logger {
logName: string;
logLevel: LogLevel;
callBacks: LogFunction[] | undefined;
/**
* Constructor to create a new Logger instance
* @param settings
*/
constructor(settings?: logger);
/**
* Function that transforms a message into a string of the format "<Date> <Time> <LogName> <LogLevel> <Message>"
* @param msg
* @param level
* @returns string
*/
stringBuilder(msg: string, level: LogLevel): string;
/**
* Function called to log a message. Messages are only logged if the provided message log level is greater then the configured log level
* @param msg
* @param level
* @returns string
*/
log(msg: string, level?: LogLevel): void;
/**
* Log a message on the socket level
* @param msg
*/
sock(msg: string): void;
/**
* Log a message on the debug level
* @param msg
*/
debug(msg: string): void;
/**
* Log a Info message
* @param msg
*/
info(msg: string): void;
/**
* Log a warn message
* @param msg
*/
warn(msg: string): void;
/**
* Log an error message
* @param msg
*/
error(msg: string): void;
}
export {};