mirror of
https://git.stamm.me/OpenServer/NodeLogging.git
synced 2024-11-16 05:01:04 +00:00
80 lines
2.0 KiB
TypeScript
80 lines
2.0 KiB
TypeScript
/// <reference types="node" />
|
|
import { EventEmitter } from "events";
|
|
export declare const Colors: {
|
|
Reset: string;
|
|
Bright: string;
|
|
Dim: string;
|
|
Underscore: string;
|
|
Blink: string;
|
|
Reverse: string;
|
|
Hidden: string;
|
|
FgBlack: string;
|
|
FgRed: string;
|
|
FgGreen: string;
|
|
FgYellow: string;
|
|
FgBlue: string;
|
|
FgMagenta: string;
|
|
FgCyan: string;
|
|
FgWhite: string;
|
|
BgBlack: string;
|
|
BgRed: string;
|
|
BgGreen: string;
|
|
BgYellow: string;
|
|
BgBlue: string;
|
|
BgMagenta: string;
|
|
BgCyan: string;
|
|
BgWhite: string;
|
|
};
|
|
export interface LoggingBaseOptions {
|
|
/**
|
|
* Name will be prefixed on Console output and added to logfiles, if not specified here
|
|
*/
|
|
name: string;
|
|
/**
|
|
* Filename/path of the logfile. Skip if generated with name
|
|
*/
|
|
logfile: string;
|
|
/**
|
|
* Filename/path of the logfile. Skip if generated with name
|
|
*/
|
|
errorfile: string;
|
|
/**
|
|
* Prints output to console
|
|
*/
|
|
console_out: boolean;
|
|
}
|
|
export declare class LoggingBase {
|
|
private config;
|
|
private writeLock;
|
|
private fileStream;
|
|
private errorStream;
|
|
private fileSize;
|
|
private errorSize;
|
|
private queue;
|
|
constructor(options?: Partial<LoggingBaseOptions>);
|
|
console_out: boolean;
|
|
waitForSetup(): Promise<void>;
|
|
private setup();
|
|
events: EventEmitter;
|
|
debug(...message: any[]): void;
|
|
log(...message: any[]): void;
|
|
warning(...message: any[]): void;
|
|
logWithCustomColors(type: LoggingTypes, colors: string, ...message: any[]): void;
|
|
error(error: Error | string): void;
|
|
errorMessage(...message: any[]): void;
|
|
private message(type, message, customColors?, caller?);
|
|
private writeMessageToFile(message, error?);
|
|
private checkQueue();
|
|
private writeToLogFile(data);
|
|
private writeToErrorFile(data);
|
|
private initializeFile(file, new_file?);
|
|
}
|
|
export declare const Logging: LoggingBase;
|
|
export default Logging;
|
|
export declare enum LoggingTypes {
|
|
Log = 0,
|
|
Warning = 1,
|
|
Error = 2,
|
|
Debug = 3,
|
|
}
|