AbstractLogger
Implements
Static Methods
::isValidLogger
Check if the given logger is valid, meaning it implements all logs methods
AbstractLogger.isValidLogger(logger): {isValid: boolean, reasons: string[]}
Parameters:
Name | Type | Required | Default | Description |
---|---|---|---|---|
logger | * | Yes | - | The logger to test |
Returns:
Type: {isValid: boolean, reasons: string[]}
A valid Logger is not only the one that inherits AbstractLogger, but any object implementing those methods. That mean you can use winston has a logger.
Constructor
AbstractEntity is abstract and cannot be instantiated
Abstract Methods
logger.log(level: enum(LogLevels), msg: string, context :object = null): void
Parameters:
Name | Type | Required | Default | Description |
---|---|---|---|---|
level | enum(LogLevels) | Yes | - | The level message |
msg | string | Yes | - | The message to log |
context | ?object | No | null | A context object which should be stringify-able |
Returns:
Type: void
This is an abstract methods that should be implemented in child classes.
Methods
error
logger.error(msg: string, context :object = null): void
Parameters:
Name | Type | Required | Default | Description |
---|---|---|---|---|
msg | string | Yes | - | The message to log |
context | ?object | No | null | A context object which should be stringify-able |
Returns:
Type: void
Internally calls
this.log(LogLevels.ERROR, msg, context)
which is abstract
warn
logger.warn(msg: string, context :object = null): void
Parameters:
Name | Type | Required | Default | Description |
---|---|---|---|---|
msg | string | Yes | - | The message to log |
context | ?object | No | null | A context object which should be stringify-able |
Returns:
Type: void
Internally calls
this.log(LogLevels.WARN, msg, context)
which is abstract
info
logger.info(msg: string, context :object = null): void
Parameters:
Name | Type | Required | Default | Description |
---|---|---|---|---|
msg | string | Yes | - | The message to log |
context | ?object | No | null | A context object which should be stringify-able |
Returns:
Type: void
Internally calls
this.log(LogLevels.INFO, msg, context)
which is abstract
verbose
logger.verbose(msg: string, context :object = null): void
Parameters:
Name | Type | Required | Default | Description |
---|---|---|---|---|
msg | string | Yes | - | The message to log |
context | ?object | No | null | A context object which should be stringify-able |
Returns:
Type: void
Internally calls
this.log(LogLevels.VERBOSE, msg, context)
which is abstract
debug
logger.debug(msg: string, context :object = null): void
Parameters:
Name | Type | Required | Default | Description |
---|---|---|---|---|
msg | string | Yes | - | The message to log |
context | ?object | No | null | A context object which should be stringify-able |
Returns:
Type: void
Internally calls
this.log(LogLevels.DEBUG, msg, context)
which is abstract
silly
logger.silly(msg: string, context :object = null): void
Parameters:
Name | Type | Required | Default | Description |
---|---|---|---|---|
msg | string | Yes | - | The message to log |
context | ?object | No | null | A context object which should be stringify-able |
Returns:
Type: void
Internally calls
this.log(LogLevels.SILLY, msg, context)
which is abstract