hce-node application  1.4.3
HCE Hierarchical Cluster Engine node application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cf_log.h
Go to the documentation of this file.
1 /*
2  * Copyright 2012 Aerospike. All rights reserved.
3  */
4 #pragma once
5 
6 #include <stdarg.h>
7 #include "cf_atomic.h"
8 
11 
12 #define G_LOG_LEVEL ((int)cf_atomic32_get(g_log_level))
13 #define G_LOG_CB ((cf_log_callback)cf_atomic_p_get(g_log_callback))
14 
15 //====================================================================
16 // Public API
17 //
18 
22 typedef enum {
27 
32 
37 
42 
47 } cf_log_level;
48 
59 typedef void (*cf_log_callback)(cf_log_level level, const char* fmt, ...);
60 
70 static inline void cf_set_log_level(cf_log_level level)
71 {
73 }
74 
86 static inline void cf_set_log_callback(cf_log_callback callback)
87 {
88  if (callback) {
89  cf_atomic_p_set(&g_log_callback, (cf_atomic_p)callback);
90  }
91 }
92 
93 static inline int cf_info_enabled()
94 {
95  return CF_INFO <= G_LOG_LEVEL;
96 }
97 
98 static inline int cf_debug_enabled()
99 {
100  return CF_DEBUG <= G_LOG_LEVEL;
101 }