mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-29 21:08:24 +00:00
Fix #1465 - rename LL_* constants, introduce MG_* log macros
This commit is contained in:
1 parent
da72dafbfb
commit
969b84043c
40 files changed
+361
-372
No files matched your search
@@ -3,7 +3,7 @@
|
||||
#include "arch.h"
|
||||
#include "config.h"
|
||||
|
||||
enum { LL_NONE, LL_ERROR, LL_INFO, LL_DEBUG, LL_VERBOSE_DEBUG };
|
||||
enum { MG_LL_NONE, MG_LL_ERROR, MG_LL_INFO, MG_LL_DEBUG, MG_LL_VERBOSE };
|
||||
void mg_log(const char *fmt, ...) PRINTF_LIKE(1, 2);
|
||||
bool mg_log_prefix(int ll, const char *file, int line, const char *fname);
|
||||
void mg_log_set(const char *spec);
|
||||
@@ -14,17 +14,22 @@ void mg_log_set_callback(void (*fn)(const void *, size_t, void *), void *param);
|
||||
|
||||
#if MG_ENABLE_LOG
|
||||
|
||||
#define LOG(level, args) \
|
||||
#define MG_LOG(level, args) \
|
||||
do { \
|
||||
if (mg_log_prefix((level), __FILE__, __LINE__, __func__)) mg_log args; \
|
||||
} while (0)
|
||||
|
||||
#else
|
||||
|
||||
#define LOG(level, args) \
|
||||
do { \
|
||||
(void) level; \
|
||||
if (0) mg_log args; \
|
||||
#define MG_LOG(level, args) \
|
||||
do { \
|
||||
(void) level; \
|
||||
if (0) mg_log args; \
|
||||
} while (0)
|
||||
|
||||
#endif
|
||||
|
||||
#define MG_ERROR(args) MG_LOG(MG_LL_ERROR, args)
|
||||
#define MG_INFO(args) MG_LOG(MG_LL_INFO, args)
|
||||
#define MG_DEBUG(args) MG_LOG(MG_LL_DEBUG, args)
|
||||
#define MG_VERBOSE(args) MG_LOG(MG_LL_VERBOSE, args)
|
||||
Reference in new issue
Block a user