hivessh
Version:
HiveSsh is an innovative library designed to streamline SSH2 connections and simplify task execution on Linux servers.
85 lines • 3.12 kB
TypeScript
export declare const logNames: readonly ["Fatal", "Error", "Warning", "Info", "Trace", "Debug"];
export type LogName = typeof logNames[number];
export declare const logShorts: readonly ["FAT", "ERR", "WAR", "INF", "TRA", "DEB"];
export type LogShort = typeof logShorts[number];
export declare const customLogType: {
[level: number]: {
name: string;
short: string;
};
};
export declare const fatalLogType: LogType;
export declare const errorLogType: LogType;
export declare const warningLogType: LogType;
export declare const infoLogType: LogType;
export declare const traceLogType: LogType;
export declare const debugLogType: LogType;
export interface LogType {
name: string;
short: string;
level: number;
}
export declare function getLogTypeByLevel(level: number): LogType;
export interface Log {
time: number;
type: LogType;
value: string;
area?: string;
}
export type LogParser = (log: Log) => string;
export declare function defaultLogParser(log: Log): string;
export declare function getLogTimestemp(date: Date | number): string;
export type PipeTargetFunc = ((log: Log) => any);
export interface PipeTargetObject {
addLog: (log: Log) => any;
}
export type PipeTarget = PipeTargetFunc | PipeTargetObject;
export interface LogRewriteOptions {
isArea?: string | string[];
notArea?: string | string[];
startsWithArea?: string | string[];
newAreaPrefix?: string;
justWithoutArea?: boolean;
justWithArea?: boolean;
minLogLevel?: number;
maxLogLevel?: number;
}
export interface LogRewriteSettings {
isArea: string[] | undefined;
notArea: string[] | undefined;
startsWithArea: string[] | undefined;
newAreaPrefix: string | undefined;
justWithoutArea?: boolean;
justWithArea?: boolean;
minLogLevel?: number;
maxLogLevel?: number;
}
export declare class Logger {
prefix: string | undefined;
logs: Log[];
pipeTargets: PipeTarget[] | undefined;
static StdOut: Logger;
static StdStreams: Logger;
constructor(pipeTargets?: PipeTarget | PipeTarget[] | undefined, prefix?: string | undefined, logs?: Log[]);
rewrite: (options: LogRewriteOptions) => PipeTargetFunc;
pipe(pipeTarget: PipeTarget, justNewLogs?: boolean): void;
unpipe(pipeTarget: PipeTarget): void;
unpipeAll(): void;
clear(): void;
fatal(value: string, area?: string): void;
error(value: string, area?: string): void;
warn(value: string, area?: string): void;
info(value: string, area?: string): void;
trace(value: string, area?: string): void;
debug(value: string, area?: string): void;
log(level: number | LogType, value: string, area?: string): void;
addLog(log: Log): void;
getAbove(level: number, includeLevel: boolean): Log[];
getBelow(level: number, includeLevel: boolean): Log[];
getLogsWithAreas(areas: string[]): Log[];
getLogsInArea(areas: string[]): Log[];
getLogsNotInAreas(areas: string[]): Log[];
parseLogs(logParser?: LogParser): string;
}
export declare function parseArea(area: string): string;
//# sourceMappingURL=logger.d.ts.map