log
provides functionality for logging messages at various severity levels.
Logs a message at the debug log level.
name | type | description |
---|---|---|
msg |
string |
The message to log. |
misc |
*args |
Additional message arguments will be concatenated to the message string separated by a space. |
kv |
**kwargs |
Key-value pairs to provide additional debug information. |
basic
Log a debug message with additional information.
load("log", "debug")
debug("Fetching data at", "21:40", retry_attempt=1)
{"retry_attempt": 1}
Logs a message at the info log level.
name | type | description |
---|---|---|
msg |
string |
The message to log. |
misc |
*args |
Additional message arguments will be concatenated to the message string separated by a space. |
kv |
**kwargs |
Key-value pairs to provide additional information. |
basic
Log an info message with additional information.
load("log", "info")
info("Data fetched", response_time=42)
Logs a message at the warn log level.
name | type | description |
---|---|---|
msg |
string |
The message to log. |
misc |
*args |
Additional message arguments will be concatenated to the message string separated by a space. |
kv |
**kwargs |
Key-value pairs to provide additional warning information. |
basic
Log a warning message with additional information.
load("log", "warn")
warn("Fetching data took longer than expected", response_time=123)
Logs a message at the error log level and returns an error.
name | type | description |
---|---|---|
msg |
string |
The message to log. |
misc |
*args |
Additional message arguments will be concatenated to the message string separated by a space. |
kv |
**kwargs |
Key-value pairs to provide additional error information. |
basic
Log an error message with additional information.
load("log", "error")
error("Failed to fetch data", response_time=240)
Logs a message at the error log level, returns a fail(msg)
to halt program execution.
name | type | description |
---|---|---|
msg |
string |
The message to log. |
misc |
*args |
Additional message arguments will be concatenated to the message string separated by a space. |
kv |
**kwargs |
Key-value pairs to provide additional fatal error information. |
basic
Log a fatal error message with additional information.
load("log", "fatal")
fatal("Failed to fetch data and cannot recover", retry_attempts=3, response_time=360)