import log4js from 'log4js'; import * as Shardus from '../shardus/shardus-types'; interface Logger { baseDir: string; config: Shardus.StrictLogsConfiguration; logDir: string; log4Conf: log4js.Configuration; _playbackLogger: any; _mainLogger: any; _seenAddresses: any; _shortStrings: any; _playbackOwner_host: any; _playbackOwner: any; _playbackIPInfo: any; _nodeInfos: any; _playbackNodeID: string; } /** * The point of LogFlags it to gain max performance when we need to reduce logging, and be able to ajust this in a simple * way when inside of a test. Almost all logging should be behind a flag. * * Some intial flags are set using log4js level * However setting such as start in fatal mode or start in error mode change this * see: config.debug.startInFatalsLogMode / config.debug.startInErrorLogMode * * The default setting is config.debug.startInErrorLogMode = true, and then the log4js setting * set to log most things. The flag if checks will then make so that generally thigns at the flags * or errors level log. There are a few expecptions. A new convetion is to use the flags * important_as_error and important_as_fatal. These are for things that are not errors or fatals * but we want to see at these levels * * verbose flag is still usefull for heavy logs, and playback seems to beneift from levels, so we could expand as needed * * */ export type LogFlags = { verbose: boolean; fatal: boolean; debug: boolean; info: boolean; error: boolean; console: boolean; playback: boolean; playback_trace: boolean; playback_debug: boolean; net_trace: boolean; p2pNonFatal: boolean; newFilter: boolean; important_as_error: boolean; important_as_fatal: boolean; net_verbose: boolean; net_stats: boolean; net_rust: boolean; dapp_verbose: boolean; profiling_verbose: boolean; aalg: boolean; shardedCache: boolean; lost: boolean; rotation: boolean; seqdiagram: boolean; txCancel: boolean; getLocalOrRemote: boolean; verboseNestedCounters: boolean; node_rotation_debug: boolean; p2pSyncDebug: boolean; p2pExtraHeavyLogs: boolean; fact: boolean; }; export declare let logFlags: LogFlags; declare class Logger { backupLogFlags: LogFlags; constructor(baseDir: string, config: Shardus.StrictLogsConfiguration, dynamicLogMode: string); _checkValidConfig(): void; _addFileNamesToAppenders(): void; _mapCustomAppenderTypes(): void; _configureLogs(): log4js.Log4js; getLogger(logger: string): log4js.Logger; _setupLogs(dynamicLogMode: string): void; shutdown(): Promise; setPlaybackIPInfo(ipInfo: any): void; setPlaybackID(nodeID: any): void; identifyNode(input: any): any; processDesc(desc: any): any; playbackLog(from: any, to: any, type: any, endpoint: any, id: any, desc: any): void; playbackLogState(newState: any, id: any, desc: any): void; playbackLogNote(noteCategory: any, id: any, desc?: any): void; setFatalFlags(): void; setDisableAllFlags(): void; setErrorFlags(): void; setDefaultFlags(): void; setFlagByName(name: string, value: boolean): void; registerEndpoints(Context: any): void; _containsProtocol(url: string): boolean; _normalizeUrl(url: string): string; _internalHackGet(url: string): Promise; _internalHackGetWithResp(url: string): Promise>; setupLogControlValues(): void; mainLog(level: any, key: string, message: string): void; mainLog_debug(key: string, message: string): void; combine(...args: any[]): string; } export default Logger;