Logs
The Exot Inspector offers an invaluable logging instrument that provides developers with comprehensive insights into their application’s behavior. Logs play a crucial role in understanding and debugging software, allowing developers to track the flow of execution, identify errors, and analyze system performance.
Instrument
Access the logs instrument via the logs
namespace:
Configuration
Configure the logs instrument using the main Inspector configuration options:
Available configuration options:
console: boolean
: Determines whether to captureconsole.*
logs (defaulttrue
).stdout: boolean
: Determines whether to captureprocess.stdout
(defaulttrue
).disabled: boolean
: Disables the instrument. When disabled, the instrument cannot be activated, and no data will be recorded (defaultfalse
).
Capturing logs
The logs instrument seamlessly intercepts console.*
functions and process.stdout
, ensuring all log messages generated via console.*
or written to stdout
are automatically captured.
Pino logger
To leverage the logging instrument with Pino, configure Pino’s destination
to process.stdout
.
Custom logger
For alternative logging mechanisms, manually write to the Inspector’s logs using the push()
function.
The level
parameter indicates the severity level of the log. It is recommended to use standard levels: trace
, debug
, info
, warn
, error
, fatal
.
Querying logs
While recorded logs can be viewed in the Application, you can programmatically retrieve logs using the query()
function.