Configures the logger with the specified log level and output options.
Parameters
Parameter
Type
Default
Description
level
str
-
Log level. Must be one of: “debug”, “info”, “warning”, “error”, “critical”.
to_file
bool
False
Whether to write logs to a file instead of stdout/stderr.
file_path
str
"cyborgdb_client.log"
(Optional) Path to the log file. Only used when to_file is True.
Exceptions
ValueError
Throws if the log level is invalid.
Example Usage
# Get the logger instancelogger = cyborgdb.Logger.instance()# Configure logger to write INFO level logs to consolelogger.configure(level="info")# Configure logger to write ERROR level logs to a filelogger.configure(level="error", to_file=True, file_path="/path/to/logs/cyborgdb.log")
The DEBUG level is only available in debug builds of the library.