log/logging
Documentation
- source: log/logging.ts
Overview
Classes
Logging
getLogger()
Retrieves or creates a Logger instance associated with a specific name. The logger name is typically used to categorize log messages (e.g., 'com.app.service').
tsstatic getLogger(loggerName: string): Logger;
Parameter Type Description loggerNamestringThe name of the logger. Returns
- Type:
Logger- Description: A Logger instance.
Logger
setLevel()
Sets the logging level for this specific logger instance. Messages below this threshold will be ignored.
tssetLevel(level: string): Logger;
Parameter Type Description levelstringThe desired logging level (e.g., 'TRACE', 'DEBUG', 'INFO', 'WARN', 'ERROR'). Returns
- Type:
Logger- Description: The Logger instance for method chaining.
isDebugEnabled()
Checks if the DEBUG level is currently enabled for this logger.
tsisDebugEnabled(): boolean;Returns
- Type:
boolean- Description: True if DEBUG logging is enabled, false otherwise.
isErrorEnabled()
Checks if the ERROR level is currently enabled for this logger.
tsisErrorEnabled(): boolean;Returns
- Type:
boolean- Description: True if ERROR logging is enabled, false otherwise.
isWarnEnabled()
Checks if the WARN level is currently enabled for this logger.
tsisWarnEnabled(): boolean;Returns
- Type:
boolean- Description: True if WARN logging is enabled, false otherwise.
isInfoEnabled()
Checks if the INFO level is currently enabled for this logger.
tsisInfoEnabled(): boolean;Returns
- Type:
boolean- Description: True if INFO logging is enabled, false otherwise.
isTraceEnabled()
Checks if the TRACE level is currently enabled for this logger.
tsisTraceEnabled(): boolean;Returns
- Type:
boolean- Description: True if TRACE logging is enabled, false otherwise.
log()
The core logging method. Logs a message at the specified level, optionally supporting parameters for message formatting and a final Error object for stack trace logging.
tslog(msg: string, level: string): void;
Parameter Type Description msgstringThe log message template (e.g., "User {0} failed to connect: {1}"). levelstringThe logging level (e.g., 'DEBUG', 'ERROR'). Returns
- Type:
void- Description:
debug()
Logs a message at the DEBUG level.
tsdebug(msg: string, _: any): void;
Parameter Type Description msgstringThe log message template. _anyReturns
- Type:
void- Description:
info()
Logs a message at the INFO level.
tsinfo(msg: string, _: any): void;
Parameter Type Description msgstringThe log message template. _anyReturns
- Type:
void- Description:
trace()
Logs a message at the TRACE level.
tstrace(msg: string, _: any): void;
Parameter Type Description msgstringThe log message template. _anyReturns
- Type:
void- Description:
warn()
Logs a message at the WARN level.
tswarn(msg: string, _: any): void;
Parameter Type Description msgstringThe log message template. _anyReturns
- Type:
void- Description:
error()
Logs a message at the ERROR level.
tserror(msg: string, _: any): void;
Parameter Type Description msgstringThe log message template. _anyReturns
- Type:
void- Description:
