Documentation Index
Fetch the complete documentation index at: https://mintlify.com/nodejs/doc-kit/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The logger provides a flexible logging system with configurable transports (console, GitHub Actions), hierarchical child loggers, and multiple log levels.Logger
Creates a new logger instance with the specified transport.Parameters
Name of the transport to use. Available options:
'console'- Standard console output with colors'github'- GitHub Actions workflow commands
Returns
Logger instance with logging methods
Throws
Throws an error if the specified transport is not found.createLogger
Low-level function to create a logger with a custom transport function.Parameters
Function to handle log output. Receives a context object with:
level(number) - Log levelmessage(string) - Log messagetimestamp(number) - Unix timestampmetadata(object) - Additional metadatamodule(string) - Optional module name
Minimum log level to output
Optional module name for the logger
Returns
Logger instance with the following methods:
Logging Methods
All logging methods accept a message and optional metadata object.info
Logs an informational message.logger/logger.mjs:84
warn
Logs a warning message.logger/logger.mjs:94
error
Logs an error message or Error object.logger/logger.mjs:104
fatal
Logs a fatal error message.logger/logger.mjs:114
debug
Logs a debug message (only visible when log level is debug).logger/logger.mjs:124
Child Loggers
child
Creates a child logger for a specific module. Child loggers:- Share the parent’s log level
- Inherit log level changes from parent
- Display module name in output
logger/logger.mjs:134
Parameters
Module name for the child logger
Returns
New child logger instance
Log Level Management
setLogLevel
Sets the log level for the logger and all its children. Changes propagate down the hierarchy.logger/logger.mjs:147
Parameters
Log level as number or string name (‘debug’, ‘info’, ‘warn’, ‘error’, ‘fatal’)
Log Levels
Log levels are defined inlogger/constants.mjs:
Message Types
The logger accepts multiple message types:String Message
Error Object
Array of Messages
Metadata
All logging methods accept an optional metadata object:Example with Metadata
Transports
Console Transport
Default transport with colored output for terminal.- Color-coded log levels
- Formatted timestamps
- Module name display
- Stack trace formatting
GitHub Transport
For GitHub Actions workflow commands.- GitHub Actions annotations
- File/line number linking
- Workflow command formatting
Examples
Basic Usage
Module-Specific Logging
generators.mjs:64
Error Logging with Context
Dynamic Log Level
Custom Transport
Default Logger Instance
The default export is a pre-configured console logger:logger/index.mjs:27
Related APIs
- Generator API - Uses logger for execution tracking
- Configuration API - No direct logging, but used with generators