Skip to content

Commit

Permalink
Add typings for helper methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyrox committed Feb 9, 2023
1 parent 6f3b68e commit c643b10
Showing 1 changed file with 60 additions and 1 deletion.
61 changes: 60 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -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<LogObj> extends BaseLogger<LogObj> {
constructor(settings?: ISettingsParam<LogObj>, 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?: LogObj): Logger<LogObj>;
}

0 comments on commit c643b10

Please sign in to comment.