Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViktors Tjarve <viktors.tjarve@zabbix.com>2019-04-03 13:07:53 +0300
committerViktors Tjarve <viktors.tjarve@zabbix.com>2019-04-03 13:07:53 +0300
commit912324929c628f9cee3c0f38d0c9055f1b5e14c0 (patch)
tree2871f6b9625a604d9c32ccc8576b9b21b4d1cd13 /include/log.h
parent2f9841ff39a5b3d3b8cd8108f9a14af688a91af4 (diff)
...G...PS. [ZBX-10889] moved log level check to 'zabbix_log' macro
[merge ^/branches/4.2 -c r91882] [merge ^/branches/4.2 -c r91883]
Diffstat (limited to 'include/log.h')
-rw-r--r--include/log.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/include/log.h b/include/log.h
index 47344c02ecd..ba479e2e0eb 100644
--- a/include/log.h
+++ b/include/log.h
@@ -40,6 +40,11 @@
#define LOG_ENTRY_INTERVAL_DELAY 60 /* seconds */
+extern int zbx_log_level;
+#define ZBX_CHECK_LOG_LEVEL(level) \
+ ((LOG_LEVEL_INFORMATION != level && \
+ (level > zbx_log_level || LOG_LEVEL_EMPTY == level)) ? FAIL : SUCCEED)
+
typedef enum
{
ERR_Z3001 = 3001,
@@ -53,7 +58,15 @@ typedef enum
zbx_err_codes_t;
#ifdef HAVE___VA_ARGS__
-# define zabbix_log(level, fmt, ...) __zbx_zabbix_log(level, ZBX_CONST_STRING(fmt), ##__VA_ARGS__)
+# define ZBX_ZABBIX_LOG_CHECK
+# define zabbix_log(level, fmt, ...) \
+ \
+ do \
+ { \
+ if (SUCCEED == ZBX_CHECK_LOG_LEVEL(level)) \
+ __zbx_zabbix_log(level, ZBX_CONST_STRING(fmt), ##__VA_ARGS__); \
+ } \
+ while (0)
#else
# define zabbix_log __zbx_zabbix_log
#endif
@@ -67,7 +80,6 @@ int zabbix_increase_log_level(void);
int zabbix_decrease_log_level(void);
const char *zabbix_get_log_level_string(void);
#endif
-int zabbix_check_log_level(int level);
char *zbx_strerror(int errnum);
char *strerror_from_system(unsigned long error);