@mimik/mim-logger
v1.0.0
Published
Lightweight logging library for mimOE runtime environment
Readme
MimLogger
Logger instance
Kind: global class
- MimLogger
- .init(contextOrConfig) ⇒ MimLogger
- .getConfig() ⇒ Object
- ._log(level, message, ...args)
- .log(level, message, ...args)
- .error(message, ...args)
- .warn(message, ...args)
- .info(message, ...args)
- .verbose(message, ...args)
- .debug(message, ...args)
- .silly(message, ...args)
- .flush() ⇒ Promise.<void>
- .flushAndExit(exitCode) ⇒ Promise.<void>
- .serializeError(err) ⇒ Object
mimLogger.init(contextOrConfig) ⇒ MimLogger
Initializes the logger with context or configuration
Kind: instance method of MimLogger
Returns: MimLogger - Logger instance for chaining
| Param | Type | Description | | --- | --- | --- | | contextOrConfig | Object | mimik context object or config with env |
mimLogger.getConfig() ⇒ Object
Gets current configuration, refreshing from context if available
Kind: instance method of MimLogger
Returns: Object - Current configuration
mimLogger._log(level, message, ...args)
Internal log method
Kind: instance method of MimLogger
| Param | Type | Description | | --- | --- | --- | | level | string | Log level | | message | string | Object | Log message or object with message property | | ...args | * | Additional arguments (metadata, correlationId) |
mimLogger.log(level, message, ...args)
Generic log method with explicit level
Kind: instance method of MimLogger
| Param | Type | Description | | --- | --- | --- | | level | string | Log level | | message | string | Object | Log message | | ...args | * | Additional arguments |
mimLogger.error(message, ...args)
Log error message
Kind: instance method of MimLogger
| Param | Type | Description | | --- | --- | --- | | message | string | Object | Log message | | ...args | * | Additional arguments |
mimLogger.warn(message, ...args)
Log warning message
Kind: instance method of MimLogger
| Param | Type | Description | | --- | --- | --- | | message | string | Object | Log message | | ...args | * | Additional arguments |
mimLogger.info(message, ...args)
Log info message
Kind: instance method of MimLogger
| Param | Type | Description | | --- | --- | --- | | message | string | Object | Log message | | ...args | * | Additional arguments |
mimLogger.verbose(message, ...args)
Log verbose message
Kind: instance method of MimLogger
| Param | Type | Description | | --- | --- | --- | | message | string | Object | Log message | | ...args | * | Additional arguments |
mimLogger.debug(message, ...args)
Log debug message
Kind: instance method of MimLogger
| Param | Type | Description | | --- | --- | --- | | message | string | Object | Log message | | ...args | * | Additional arguments |
mimLogger.silly(message, ...args)
Log silly message
Kind: instance method of MimLogger
| Param | Type | Description | | --- | --- | --- | | message | string | Object | Log message | | ...args | * | Additional arguments |
mimLogger.flush() ⇒ Promise.<void>
Flush all transports (for graceful shutdown)
Kind: instance method of MimLogger
mimLogger.flushAndExit(exitCode) ⇒ Promise.<void>
Flush all transports and exit process
Kind: instance method of MimLogger
| Param | Type | Default | Description | | --- | --- | --- | --- | | exitCode | number | 0 | Process exit code |
mimLogger.serializeError(err) ⇒ Object
Utility to serialize errors
Kind: instance method of MimLogger
Returns: Object - Serialized error
| Param | Type | Description | | --- | --- | --- | | err | Error | Error to serialize |
