Couchbase C Client  3.3.14
Asynchronous C Client for Couchbase
logger.h
1/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/*
3 * Copyright 2012-2020 Couchbase, Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef LIBCOUCHBASE_LOGGER_H
19#define LIBCOUCHBASE_LOGGER_H
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
29typedef enum {
30 LCB_LOG_TRACE = 0,
31 LCB_LOG_DEBUG,
32 LCB_LOG_INFO,
33 LCB_LOG_WARN,
34 LCB_LOG_ERROR,
35 LCB_LOG_FATAL,
36 LCB_LOG__MAX
37} lcb_LOG_SEVERITY;
38
44#define LCB_LOG_SPEC(fmt) "%s" fmt "%s"
45
46#define LCB_LOG_UD_OTAG "<ud>"
47#define LCB_LOG_UD_CTAG "</ud>"
59#define LCB_LOG_UD(instance, val) \
60 lcb_is_redacting_logs(instance) ? LCB_LOG_UD_OTAG : "", val, lcb_is_redacting_logs(instance) ? LCB_LOG_UD_CTAG : ""
61
62#define LCB_LOG_MD_OTAG "<md>"
63#define LCB_LOG_MD_CTAG "</md>"
76#define LCB_LOG_MD(instance, val) \
77 lcb_is_redacting_logs(instance) ? LCB_LOG_MD_OTAG : "", val, lcb_is_redacting_logs(instance) ? LCB_LOG_MD_CTAG : ""
78
79#define LCB_LOG_SD_OTAG "<sd>"
80#define LCB_LOG_SD_CTAG "</sd>"
90#define LCB_LOG_SD(instance, val) \
91 lcb_is_redacting_logs(instance) ? LCB_LOG_SD_OTAG : "", val, lcb_is_redacting_logs(instance) ? LCB_LOG_SD_CTAG : ""
92
93typedef struct lcb_LOGGER_ lcb_LOGGER;
94
109typedef void (*lcb_LOGGER_CALLBACK)(const lcb_LOGGER *procs, uint64_t iid, const char *subsys,
110 lcb_LOG_SEVERITY severity, const char *srcfile, int srcline, const char *fmt,
111 va_list ap);
112
122LIBCOUCHBASE_API lcb_STATUS lcb_logger_create(lcb_LOGGER **logger, void *cookie);
123
130LIBCOUCHBASE_API lcb_STATUS lcb_logger_destroy(lcb_LOGGER *logger);
131
141LIBCOUCHBASE_API lcb_STATUS lcb_logger_callback(lcb_LOGGER *logger, lcb_LOGGER_CALLBACK callback);
142
152LIBCOUCHBASE_API lcb_STATUS lcb_logger_cookie(const lcb_LOGGER *logger, void **cookie);
153
154#ifdef __cplusplus
155}
156#endif /* __cplusplus */
157#endif // LIBCOUCHBASE_LOGGER_H
lcb_STATUS
Error codes returned by the library.
Definition error.h:213