Debugging Locally
Useful tricks for debugging bacalhau when developing it locally.
Logging
We use the zerolog library for logging and so the usual log levels are supported (debug
, info
, warn
, error
, fatal
).
The log level is controlled by the LOG_LEVEL
variable:
An example of printing a log at a certain level (this is literally just using the zero log library):
We also have the LOG_TYPE
variable which controls what format the log messages are printed in:
text
(default): Prints the log message usingzerolog.ConsoleWriter
so you see text output.json
: Prints line delimited JSON logsevent
: Prints only the event logscombined
: Prints text, json and event logs
Event log
Event logs are useful when you need to understand the flow of events through the system.
They are much less noisy and are only called from the requester node and compute node when a job is transitioned to a new state.
To print only event logs - you use the LOG_TYPE
variable:
It's sometimes useful to see the text output on stdout but also write just the event log to a file - for this the LOG_EVENT_FILE
variable can be used:
An example of calling the event log library: