From c643b109dbb5a6091d75aca42e62113d522fbd43 Mon Sep 17 00:00:00 2001 From: Mark-Oliver Junge Date: Thu, 9 Feb 2023 16:15:38 +0100 Subject: [PATCH] Add typings for helper methods --- src/index.ts | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 41d3b32..e171743 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,66 @@ -import { BaseLogger, ISettingsParam, ILogObj } from "./BaseLogger.js"; +import { BaseLogger, ISettingsParam, ILogObj, ILogObjMeta } from "./BaseLogger.js"; export { ISettingsParam, BaseLogger, ILogObj }; export declare class Logger extends BaseLogger { constructor(settings?: ISettingsParam, logObj?: LogObj); + + + /** + * Logs a message with a custom log level. + * @param logLevelId - Log level ID e.g. 0 + * @param logLevelName - Log level name e.g. silly + * @param args - Multiple log attributes that should be logged out. + */ + public log(logLevelId: number, logLevelName: string, ...args: unknown[]): (LogObj & ILogObjMeta & ILogObj) | undefined; + + /** + * Logs a silly message. + * @param args - Multiple log attributes that should be logged out. + */ + public silly(...args: unknown[]): (LogObj & ILogObjMeta) | undefined; + + /** + * Logs a trace message. + * @param args - Multiple log attributes that should be logged out. + */ + public trace(...args: unknown[]): (LogObj & ILogObjMeta) | undefined; + + /** + * Logs a debug message. + * @param args - Multiple log attributes that should be logged out. + */ + public debug(...args: unknown[]): (LogObj & ILogObjMeta) | undefined; + + /** + * Logs an info message. + * @param args - Multiple log attributes that should be logged out. + */ + public info(...args: unknown[]): (LogObj & ILogObjMeta) | undefined; + + /** + * Logs a warn message. + * @param args - Multiple log attributes that should be logged out. + */ + public warn(...args: unknown[]): (LogObj & ILogObjMeta) | undefined; + + /** + * Logs an error message. + * @param args - Multiple log attributes that should be logged out. + */ + public error(...args: unknown[]): (LogObj & ILogObjMeta) | undefined; + + /** + * Logs a fatal message. + * @param args - Multiple log attributes that should be logged out. + */ + public fatal(...args: unknown[]): (LogObj & ILogObjMeta) | undefined; + + /** + * Returns a child logger based on the current instance with inherited settings + * + * @param settings - Overwrite settings inherited from parent logger + * @param logObj - Overwrite logObj for sub-logger + */ + public getSubLogger(settings?: ISettingsParam, logObj?: LogObj): Logger; }