Couchbase Lite C
Couchbase Lite C API
|
Managing messages that Couchbase Lite logs at runtime. More...
Data Structures | |
struct | CBLLogFileConfiguration |
The properties for configuring logging to files. More... | |
Enumerations | |
enum | CBLLogDomain : uint8_t { kCBLLogDomainDatabase , kCBLLogDomainQuery , kCBLLogDomainReplicator , kCBLLogDomainNetwork } |
Subsystems that log information. More... | |
enum | CBLLogLevel : uint8_t { kCBLLogDebug , kCBLLogVerbose , kCBLLogInfo , kCBLLogWarning , kCBLLogError , kCBLLogNone } |
Levels of log messages. More... | |
Functions | |
void | CBL_Log (CBLLogDomain domain, CBLLogLevel level, const char *format,...) __printflike(3 |
Formats and writes a message to the log, in the given domain at the given level. More... | |
void void | CBL_LogMessage (CBLLogDomain domain, CBLLogLevel level, FLSlice message) |
Writes a pre-formatted message to the log, exactly as given. More... | |
Console Logging and Custom Logging | |
typedef void(* | CBLLogCallback) (CBLLogDomain domain, CBLLogLevel level, FLString message) |
A logging callback that the application can register. More... | |
CBLLogLevel | CBLLog_ConsoleLevel (void) |
Gets the current log level for debug console logging. More... | |
void | CBLLog_SetConsoleLevel (CBLLogLevel) |
Sets the detail level of logging. More... | |
CBLLogLevel | CBLLog_CallbackLevel (void) |
Gets the current log level for debug console logging. More... | |
void | CBLLog_SetCallbackLevel (CBLLogLevel) |
Sets the detail level of logging. More... | |
CBLLogCallback | CBLLog_Callback (void) |
Gets the current log callback. More... | |
void | CBLLog_SetCallback (CBLLogCallback _cbl_nullable callback) |
Sets the callback for receiving log messages. More... | |
Log File Configuration | |
const CBLLogFileConfiguration *_cbl_nullable | CBLLog_FileConfig (void) |
Gets the current file logging configuration, or NULL if none is configured. More... | |
bool | CBLLog_SetFileConfig (CBLLogFileConfiguration, CBLError *_cbl_nullable outError) |
Sets the file logging configuration, and begins logging to files. More... | |
Managing messages that Couchbase Lite logs at runtime.
typedef void(* CBLLogCallback) (CBLLogDomain domain, CBLLogLevel level, FLString message) |
A logging callback that the application can register.
domain | The domain of the message |
level | The severity level of the message. |
message | The actual formatted message. |
enum CBLLogDomain : uint8_t |
enum CBLLogLevel : uint8_t |
Levels of log messages.
Higher values are more important/severe. Each level includes the lower ones.
void CBL_Log | ( | CBLLogDomain | domain, |
CBLLogLevel | level, | ||
const char * | format, | ||
... | |||
) |
Formats and writes a message to the log, in the given domain at the given level.
printf
-style format string, with extra parameters to match the format placeholders, and has the same security vulnerabilities as other printf
-style functions.If you are logging a fixed string, call CBL_LogMessage instead, otherwise any %
characters in the format
string will be misinterpreted as placeholders and the dreaded Undefined Behavior will result, possibly including crashes or overwriting the stack.
domain | The log domain to associate this message with. |
level | The severity of the message. If this is lower than the current minimum level for the domain (as set by CBLLog_SetConsoleLevel), nothing is logged. |
format | A printf -style format string. % characters in this string introduce parameters, and corresponding arguments must follow. |
void void CBL_LogMessage | ( | CBLLogDomain | domain, |
CBLLogLevel | level, | ||
FLSlice | message | ||
) |
Writes a pre-formatted message to the log, exactly as given.
domain | The log domain to associate this message with. |
level | The severity of the message. If this is lower than the current minimum level for the domain (as set by CBLLog_SetConsoleLevel), nothing is logged. |
message | The exact message to write to the log. |
CBLLogCallback CBLLog_Callback | ( | void | ) |
Gets the current log callback.
CBLLogLevel CBLLog_CallbackLevel | ( | void | ) |
Gets the current log level for debug console logging.
Only messages at this level or higher will be logged to the callback.
CBLLogLevel CBLLog_ConsoleLevel | ( | void | ) |
Gets the current log level for debug console logging.
Only messages at this level or higher will be logged to the console.
const CBLLogFileConfiguration *_cbl_nullable CBLLog_FileConfig | ( | void | ) |
Gets the current file logging configuration, or NULL if none is configured.
void CBLLog_SetCallback | ( | CBLLogCallback _cbl_nullable | callback | ) |
Sets the callback for receiving log messages.
If set to NULL, no messages are logged to the console.
void CBLLog_SetCallbackLevel | ( | CBLLogLevel | ) |
Sets the detail level of logging.
Only messages whose level is ≥ the given level will be logged to the callback.
void CBLLog_SetConsoleLevel | ( | CBLLogLevel | ) |
Sets the detail level of logging.
Only messages whose level is ≥ the given level will be logged to the console.
bool CBLLog_SetFileConfig | ( | CBLLogFileConfiguration | , |
CBLError *_cbl_nullable | outError | ||
) |
Sets the file logging configuration, and begins logging to files.