@subsquid/logger is Squid SDK’s structured logger. It is a small native implementation, not a Pino logger. The package exports a createPinoSink() adapter for applications that want to route its records through Pino.
Legacy chain-specific processors inject a Logger into the handler context as ctx.log, bound to the sqd:processor:mapping namespace. Portal-native processors built with @subsquid/batch-processor do not inject a logger. Create one explicitly:
Logger exposes the following logging levels, in order of increasing severity:
TRACEDEBUGINFOWARNERRORFATAL
INFO.
Each level accepts either a message or an attributes object followed by a message:
Child loggers
child() creates a logger that inherits its parent’s namespace and attributes. It has two overloads:
Output format and destination
The built-in sinks always write to standard error. Output format is selected when@subsquid/logger is first imported:
Set the variable before starting Node because the selection is made at module initialization:
Overriding the log level
The log level can be overridden by setting a matching namespace selector to one of theSQD_TRACE, …, SQD_FATAL environment variables. To set the handler log level to DEBUG, set SQD_DEBUG to sqd:processor:mapping:
sqd:processor.
Accessing logs of a deployed Squid
Processor logs can be inspected after the squid is deployed to Cloud:For older version-based deployments...
For older version-based deployments...
info, warning, debug, and error. The error filter includes messages emitted through ctx.log.error, ctx.log.fatal, and ctx.log.trace.
See CLI Reference or sqd logs --help for a full list of log options supported by SQD Cloud.