mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-21 19:51:50 +00:00
Remove cs_dbg.h from amalgamated headers
PUBLISHED_FROM=993c4b1bec363e3f7975b83710e694792bedf5b3
This commit is contained in:
1 parent
af6fc64ab9
commit
f149f4aab1
10 files changed
+145
-136
No files matched your search
+137
-63
@@ -55,6 +55,7 @@
|
||||
|
||||
/* Amalgamated: #include "mongoose/src/net.h" */
|
||||
/* Amalgamated: #include "mongoose/src/http.h" */
|
||||
/* Amalgamated: #include "common/cs_dbg.h" */
|
||||
|
||||
#define MG_CTL_MSG_MESSAGE_SIZE 8192
|
||||
|
||||
@@ -120,6 +121,142 @@ extern void *(*test_calloc)(size_t count, size_t size);
|
||||
|
||||
#endif /* CS_MONGOOSE_SRC_INTERNAL_H_ */
|
||||
#ifdef MG_MODULE_LINES
|
||||
#line 1 "./src/../../common/cs_dbg.h"
|
||||
#endif
|
||||
/*
|
||||
* Copyright (c) 2014-2016 Cesanta Software Limited
|
||||
* All rights reserved
|
||||
*/
|
||||
|
||||
#ifndef CS_COMMON_CS_DBG_H_
|
||||
#define CS_COMMON_CS_DBG_H_
|
||||
|
||||
#ifndef CS_DISABLE_STDIO
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
enum cs_log_level {
|
||||
LL_NONE = -1,
|
||||
LL_ERROR = 0,
|
||||
LL_WARN = 1,
|
||||
LL_INFO = 2,
|
||||
LL_DEBUG = 3,
|
||||
LL_VERBOSE_DEBUG = 4,
|
||||
|
||||
_LL_MIN = -2,
|
||||
_LL_MAX = 5,
|
||||
};
|
||||
|
||||
void cs_log_set_level(enum cs_log_level level);
|
||||
|
||||
#ifndef CS_DISABLE_STDIO
|
||||
|
||||
void cs_log_set_file(FILE *file);
|
||||
|
||||
extern enum cs_log_level cs_log_level;
|
||||
void cs_log_print_prefix(const char *func);
|
||||
void cs_log_printf(const char *fmt, ...);
|
||||
|
||||
#define LOG(l, x) \
|
||||
if (cs_log_level >= l) { \
|
||||
cs_log_print_prefix(__func__); \
|
||||
cs_log_printf x; \
|
||||
}
|
||||
|
||||
#ifndef CS_NDEBUG
|
||||
|
||||
#define DBG(x) \
|
||||
if (cs_log_level >= LL_VERBOSE_DEBUG) { \
|
||||
cs_log_print_prefix(__func__); \
|
||||
cs_log_printf x; \
|
||||
}
|
||||
|
||||
#else /* NDEBUG */
|
||||
|
||||
#define DBG(x)
|
||||
|
||||
#endif
|
||||
|
||||
#else /* CS_DISABLE_STDIO */
|
||||
|
||||
#define LOG(l, x)
|
||||
#define DBG(x)
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* CS_COMMON_CS_DBG_H_ */
|
||||
#ifdef MG_MODULE_LINES
|
||||
#line 1 "./src/../../common/cs_dbg.c"
|
||||
#endif
|
||||
/*
|
||||
* Copyright (c) 2014-2016 Cesanta Software Limited
|
||||
* All rights reserved
|
||||
*/
|
||||
|
||||
/* Amalgamated: #include "common/cs_dbg.h" */
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* Amalgamated: #include "common/cs_time.h" */
|
||||
|
||||
enum cs_log_level cs_log_level =
|
||||
#ifdef CS_ENABLE_DEBUG
|
||||
LL_VERBOSE_DEBUG;
|
||||
#else
|
||||
LL_ERROR;
|
||||
#endif
|
||||
|
||||
#ifndef CS_DISABLE_STDIO
|
||||
|
||||
FILE *cs_log_file = NULL;
|
||||
|
||||
#ifdef CS_LOG_TS_DIFF
|
||||
double cs_log_ts;
|
||||
#endif
|
||||
|
||||
void cs_log_print_prefix(const char *func) {
|
||||
if (cs_log_file == NULL) cs_log_file = stderr;
|
||||
fprintf(cs_log_file, "%-20s ", func);
|
||||
#ifdef CS_LOG_TS_DIFF
|
||||
{
|
||||
double now = cs_time();
|
||||
fprintf(cs_log_file, "%7u ", (unsigned int) ((now - cs_log_ts) * 1000000));
|
||||
cs_log_ts = now;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void cs_log_printf(const char *fmt, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
vfprintf(cs_log_file, fmt, ap);
|
||||
va_end(ap);
|
||||
fputc('\n', cs_log_file);
|
||||
fflush(cs_log_file);
|
||||
}
|
||||
|
||||
void cs_log_set_file(FILE *file) {
|
||||
cs_log_file = file;
|
||||
}
|
||||
|
||||
#endif /* !CS_DISABLE_STDIO */
|
||||
|
||||
void cs_log_set_level(enum cs_log_level level) {
|
||||
cs_log_level = level;
|
||||
#if defined(CS_LOG_TS_DIFF) && !defined(CS_DISABLE_STDIO)
|
||||
cs_log_ts = cs_time();
|
||||
#endif
|
||||
}
|
||||
#ifdef MG_MODULE_LINES
|
||||
#line 1 "./src/../../common/base64.c"
|
||||
#endif
|
||||
/*
|
||||
@@ -323,69 +460,6 @@ int cs_base64_decode(const unsigned char *s, int len, char *dst) {
|
||||
|
||||
#endif /* EXCLUDE_COMMON */
|
||||
#ifdef MG_MODULE_LINES
|
||||
#line 1 "./src/../../common/cs_dbg.c"
|
||||
#endif
|
||||
/*
|
||||
* Copyright (c) 2014-2016 Cesanta Software Limited
|
||||
* All rights reserved
|
||||
*/
|
||||
|
||||
/* Amalgamated: #include "common/cs_dbg.h" */
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* Amalgamated: #include "common/cs_time.h" */
|
||||
|
||||
enum cs_log_level cs_log_level =
|
||||
#ifdef CS_ENABLE_DEBUG
|
||||
LL_VERBOSE_DEBUG;
|
||||
#else
|
||||
LL_ERROR;
|
||||
#endif
|
||||
|
||||
#ifndef CS_DISABLE_STDIO
|
||||
|
||||
FILE *cs_log_file = NULL;
|
||||
|
||||
#ifdef CS_LOG_TS_DIFF
|
||||
double cs_log_ts;
|
||||
#endif
|
||||
|
||||
void cs_log_print_prefix(const char *func) {
|
||||
if (cs_log_file == NULL) cs_log_file = stderr;
|
||||
fprintf(cs_log_file, "%-20s ", func);
|
||||
#ifdef CS_LOG_TS_DIFF
|
||||
{
|
||||
double now = cs_time();
|
||||
fprintf(cs_log_file, "%7u ", (unsigned int) ((now - cs_log_ts) * 1000000));
|
||||
cs_log_ts = now;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void cs_log_printf(const char *fmt, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
vfprintf(cs_log_file, fmt, ap);
|
||||
va_end(ap);
|
||||
fputc('\n', cs_log_file);
|
||||
fflush(cs_log_file);
|
||||
}
|
||||
|
||||
void cs_log_set_file(FILE *file) {
|
||||
cs_log_file = file;
|
||||
}
|
||||
|
||||
#endif /* !CS_DISABLE_STDIO */
|
||||
|
||||
void cs_log_set_level(enum cs_log_level level) {
|
||||
cs_log_level = level;
|
||||
#if defined(CS_LOG_TS_DIFF) && !defined(CS_DISABLE_STDIO)
|
||||
cs_log_ts = cs_time();
|
||||
#endif
|
||||
}
|
||||
#ifdef MG_MODULE_LINES
|
||||
#line 1 "./src/../../common/cs_dirent.h"
|
||||
#endif
|
||||
/*
|
||||
|
||||
Reference in new issue
Block a user