UNPKG

@egi/smart-db

Version:

Unified Smart DB Access

41 lines (40 loc) 1.9 kB
import { SmartDb } from "./smart-db"; import { SmartErrorSeverityValue, SmartErrorLocationValue } from "./smart-error"; export declare const SeverityLevel: { readonly None: 0; readonly Fatal: 1; readonly Error: 2; readonly Warning: 3; readonly Info: 4; readonly Debug: 5; readonly All: 9; }; export declare type SeverityLevelType = typeof SeverityLevel; export declare type SeverityLevelKey = keyof SeverityLevelType; export declare type SeverityLevelValue = SeverityLevelType[keyof SeverityLevelType]; export declare class SmartDbLog { private db; private dbLogLevel; private consoleLogLevel; private userId; private dbLogging; private isLogging; private logFifo; constructor(db?: SmartDb); getConsoleLogLevel(): SeverityLevelValue; getDbLogLevel(): SeverityLevelValue; getDbLogging(): boolean; logDebug(type: SmartErrorLocationValue, location: string, message: string | Error, data?: any): void; logError(type: SmartErrorLocationValue, location: string, message: string | Error, data?: any): void; logFatal(type: SmartErrorLocationValue, location: string, message: string | Error, data?: any): void; logInfo(type: SmartErrorLocationValue, location: string, message: string | Error, data?: any): void; logWarning(type: SmartErrorLocationValue, location: string, message: string | Error, data?: any): void; setConsoleLogLevel(consoleLogLevel: SeverityLevelValue): void; setDb(db: SmartDb): void; setDbLogLevel(dbLogLevel: SeverityLevelValue): void; setDbLogging(dbLogging: boolean): void; setUserId(userId: string | number): void; writeLog(type: SmartErrorLocationValue, location: string, severity: SmartErrorSeverityValue, message: string | Error, data: unknown, timestamp?: Date | string | number): void; private nextStackEntry; } export declare const smartDbLog: SmartDbLog;