Loading...
Searching...
No Matches
as_log_macros.h
Go to the documentation of this file.
1/*
2 * Copyright 2008-2018 Aerospike, Inc.
3 *
4 * Portions may be licensed to Aerospike, Inc. under one or more contributor
5 * license agreements.
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
8 * use this file except in compliance with the License. You may obtain a copy of
9 * the License at 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, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 */
17#pragma once
18
19#include <aerospike/as_log.h>
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25/******************************************************************************
26 * as_log.h MACROS
27 *****************************************************************************/
28
29#define as_log_error_enabled() (g_as_log.callback && AS_LOG_LEVEL_ERROR <= g_as_log.level)
30#define as_log_warn_enabled() (g_as_log.callback && AS_LOG_LEVEL_WARN <= g_as_log.level)
31#define as_log_info_enabled() (g_as_log.callback && AS_LOG_LEVEL_INFO <= g_as_log.level)
32#define as_log_debug_enabled() (g_as_log.callback && AS_LOG_LEVEL_DEBUG <= g_as_log.level)
33#define as_log_trace_enabled() (g_as_log.callback && AS_LOG_LEVEL_TRACE <= g_as_log.level)
34
35#define as_log_error(__fmt, ... ) \
36 if (g_as_log.callback) {\
37 (g_as_log.callback) (AS_LOG_LEVEL_ERROR, __func__, __FILE__, __LINE__, __fmt, ##__VA_ARGS__);\
38 }
39
40#define as_log_warn(__fmt, ... ) \
41 if (g_as_log.callback && AS_LOG_LEVEL_WARN <= g_as_log.level) {\
42 (g_as_log.callback) (AS_LOG_LEVEL_WARN, __func__, __FILE__, __LINE__, __fmt, ##__VA_ARGS__);\
43 }
44
45#define as_log_info(__fmt, ... ) \
46 if (g_as_log.callback && AS_LOG_LEVEL_INFO <= g_as_log.level) {\
47 (g_as_log.callback) (AS_LOG_LEVEL_INFO, __func__, __FILE__, __LINE__, __fmt, ##__VA_ARGS__);\
48 }
49
50#define as_log_debug(__fmt, ... ) \
51 if (g_as_log.callback && AS_LOG_LEVEL_DEBUG <= g_as_log.level) {\
52 (g_as_log.callback) (AS_LOG_LEVEL_DEBUG, __func__, __FILE__, __LINE__, __fmt, ##__VA_ARGS__);\
53 }
54
55#define as_log_trace(__fmt, ... ) \
56 if (g_as_log.callback && AS_LOG_LEVEL_TRACE <= g_as_log.level) {\
57 (g_as_log.callback) (AS_LOG_LEVEL_TRACE, __func__, __FILE__, __LINE__, __fmt, ##__VA_ARGS__);\
58 }
59
60#ifdef __cplusplus
61} // end extern "C"
62#endif