Client
Logger
The cyborg::Logger
class provides thread-safe logging capabilities for CyborgDB C++ operations. It follows a singleton pattern, allowing you to configure and access the same logger instance across your application.
Configure Logger
Configures the logger with the specified log level and output options.
Parameters
Parameter | Type | Default | Description |
---|---|---|---|
level | LogLevel | - | Log level enum value: LogLevel::Debug , LogLevel::Info , LogLevel::Warning , LogLevel::Error , or LogLevel::Critical . |
to_file | bool | - | Whether to write logs to a file instead of stdout/stderr. |
file_path | const std::string& | "" | (Optional) Path to the log file. Only used when to_file is true . |
Exceptions
- If the file cannot be opened, logs will be written to standard output instead, and an error message will be printed to
std::cerr
.
Example Usage
The
Debug
level is only available in debug builds of the library (compiled with the DEBUG flag).