Couchbase Lite C
Couchbase Lite C API
CBLLog.h
Go to the documentation of this file.
1//
2// CBLLog.h
3//
4// Copyright © 2019 Couchbase. All rights reserved.
5//
6// Licensed under the Apache License, Version 2.0 (the "License");
7// you may not use this file except in compliance with the License.
8// You may obtain a copy of the License at
9//
10// http://www.apache.org/licenses/LICENSE-2.0
11//
12// Unless required by applicable law or agreed to in writing, software
13// distributed under the License is distributed on an "AS IS" BASIS,
14// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15// See the License for the specific language governing permissions and
16// limitations under the License.
17//
18
19#pragma once
20#include "CBLBase.h"
21
23
24
30typedef CBL_ENUM(uint8_t, CBLLogDomain) {
35};
36
38typedef CBL_ENUM(uint8_t, CBLLogLevel) {
45};
46
47
60 CBLLogLevel level,
61 const char *format, ...) CBLAPI __printflike(3, 4);
62
69 CBLLogLevel level,
70 FLSlice message) CBLAPI;
71
72
73
81typedef void (*CBLLogCallback)(CBLLogDomain domain,
82 CBLLogLevel level,
83 FLString message);
84
88
92
96
100
103
106
117typedef struct {
120 uint32_t maxRotateCount;
121 size_t maxSize;
124
127
130
#define CBLAPI
Definition: CBL_Compat.h:98
#define _cbl_nullable
Definition: CBL_Compat.h:86
#define CBL_CAPI_BEGIN
Definition: CBL_Compat.h:99
#define CBL_CAPI_END
Definition: CBL_Compat.h:100
#define __printflike(fmtarg, firstvararg)
Definition: CBL_Compat.h:125
#define CBL_ENUM(_type, _name)
Definition: CBL_Compat.h:56
const CBLLogFileConfiguration *_cbl_nullable CBLLog_FileConfig(void)
Gets the current file logging configuration, or NULL if none is configured.
void CBLLog_SetCallbackLevel(CBLLogLevel)
Sets the detail level of logging.
void(* CBLLogCallback)(CBLLogDomain domain, CBLLogLevel level, FLString message)
A logging callback that the application can register.
Definition: CBLLog.h:81
CBLLogLevel CBLLog_CallbackLevel(void)
Gets the current log level for debug console logging.
void void CBL_LogMessage(CBLLogDomain domain, CBLLogLevel level, FLSlice message)
Writes a pre-formatted message to the log, exactly as given.
CBLLogCallback CBLLog_Callback(void)
Gets the current log callback.
bool CBLLog_SetFileConfig(CBLLogFileConfiguration, CBLError *_cbl_nullable outError)
Sets the file logging configuration, and begins logging to files.
CBLLogLevel CBLLog_ConsoleLevel(void)
Gets the current log level for debug console logging.
void CBLLog_SetCallback(CBLLogCallback _cbl_nullable callback)
Sets the callback for receiving log messages.
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.
CBLLogDomain
Subsystems that log information.
Definition: CBLLog.h:30
CBLLogLevel
Levels of log messages.
Definition: CBLLog.h:38
void CBLLog_SetConsoleLevel(CBLLogLevel)
Sets the detail level of logging.
@ kCBLLogDomainDatabase
Definition: CBLLog.h:31
@ kCBLLogDomainReplicator
Definition: CBLLog.h:33
@ kCBLLogDomainNetwork
Definition: CBLLog.h:34
@ kCBLLogDomainQuery
Definition: CBLLog.h:32
@ kCBLLogWarning
Messages warning about unlikely and possibly bad stuff.
Definition: CBLLog.h:42
@ kCBLLogVerbose
Detailed messages about normally-unimportant stuff.
Definition: CBLLog.h:40
@ kCBLLogDebug
Extremely detailed messages, only written by debug builds of CBL.
Definition: CBLLog.h:39
@ kCBLLogNone
Disables logging entirely.
Definition: CBLLog.h:44
@ kCBLLogInfo
Messages about ordinary behavior.
Definition: CBLLog.h:41
@ kCBLLogError
Messages about errors.
Definition: CBLLog.h:43
A struct holding information about an error.
Definition: CBLBase.h:104
The properties for configuring logging to files.
Definition: CBLLog.h:117
uint32_t maxRotateCount
Max number of older log files to keep (in addition to current one.)
Definition: CBLLog.h:120
size_t maxSize
The size in bytes at which a file will be rotated out (best effort).
Definition: CBLLog.h:121
bool usePlaintext
Whether or not to log in plaintext (as opposed to binary.) Plaintext logging is slower and bigger.
Definition: CBLLog.h:122
CBLLogLevel level
The minimum level of message to write.
Definition: CBLLog.h:118
FLString directory
The directory where log files will be created.
Definition: CBLLog.h:119
A simple reference to a block of memory.
Definition: FLSlice.h:46