Skip to content

Commit 184ea4e

Browse files
committed
Prefix logger.h macros with erpc_
1 parent 2ab3bc7 commit 184ea4e

File tree

1 file changed

+28
-27
lines changed

1 file changed

+28
-27
lines changed

src/util/logger.h

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -34,70 +34,71 @@ namespace erpc {
3434
#define ERPC_LOG_DEFAULT_STREAM stdout
3535

3636
// Log messages with "reorder" or higher verbosity get written to
37-
// trace_file_or_default_stream. This can be stdout for basic debugging, or
37+
// erpc_trace_file_or_default_stream. This can be stdout for basic debugging, or
3838
// eRPC's trace file for more involved debugging.
3939

40-
#define trace_file_or_default_stream trace_file
41-
//#define trace_file_or_default_stream ERPC_LOG_DEFAULT_STREAM
40+
#define erpc_trace_file_or_default_stream trace_file
41+
//#define erpc_trace_file_or_default_stream ERPC_LOG_DEFAULT_STREAM
4242

4343
// If ERPC_LOG_LEVEL is not defined, default to the highest level so that
4444
// YouCompleteMe does not report compilation errors
4545
#ifndef ERPC_LOG_LEVEL
4646
#define ERPC_LOG_LEVEL ERPC_LOG_LEVEL_CC
4747
#endif
4848

49-
static void output_log_header(int level);
50-
5149
#if ERPC_LOG_LEVEL >= ERPC_LOG_LEVEL_ERROR
52-
#define ERPC_ERROR(...) \
53-
output_log_header(ERPC_LOG_DEFAULT_STREAM, ERPC_LOG_LEVEL_ERROR); \
54-
fprintf(ERPC_LOG_DEFAULT_STREAM, __VA_ARGS__); \
50+
#define ERPC_ERROR(...) \
51+
erpc_output_log_header(ERPC_LOG_DEFAULT_STREAM, ERPC_LOG_LEVEL_ERROR); \
52+
fprintf(ERPC_LOG_DEFAULT_STREAM, __VA_ARGS__); \
5553
fflush(ERPC_LOG_DEFAULT_STREAM)
5654
#else
5755
#define ERPC_ERROR(...) ((void)0)
5856
#endif
5957

6058
#if ERPC_LOG_LEVEL >= ERPC_LOG_LEVEL_WARN
61-
#define ERPC_WARN(...) \
62-
output_log_header(ERPC_LOG_DEFAULT_STREAM, ERPC_LOG_LEVEL_WARN); \
63-
fprintf(ERPC_LOG_DEFAULT_STREAM, __VA_ARGS__); \
59+
#define ERPC_WARN(...) \
60+
erpc_output_log_header(ERPC_LOG_DEFAULT_STREAM, ERPC_LOG_LEVEL_WARN); \
61+
fprintf(ERPC_LOG_DEFAULT_STREAM, __VA_ARGS__); \
6462
fflush(ERPC_LOG_DEFAULT_STREAM)
6563
#else
6664
#define ERPC_WARN(...) ((void)0)
6765
#endif
6866

6967
#if ERPC_LOG_LEVEL >= ERPC_LOG_LEVEL_INFO
70-
#define ERPC_INFO(...) \
71-
output_log_header(ERPC_LOG_DEFAULT_STREAM, ERPC_LOG_LEVEL_INFO); \
72-
fprintf(ERPC_LOG_DEFAULT_STREAM, __VA_ARGS__); \
68+
#define ERPC_INFO(...) \
69+
erpc_output_log_header(ERPC_LOG_DEFAULT_STREAM, ERPC_LOG_LEVEL_INFO); \
70+
fprintf(ERPC_LOG_DEFAULT_STREAM, __VA_ARGS__); \
7371
fflush(ERPC_LOG_DEFAULT_STREAM)
7472
#else
7573
#define ERPC_INFO(...) ((void)0)
7674
#endif
7775

7876
#if ERPC_LOG_LEVEL >= ERPC_LOG_LEVEL_REORDER
79-
#define ERPC_REORDER(...) \
80-
output_log_header(trace_file_or_default_stream, ERPC_LOG_LEVEL_REORDER); \
81-
fprintf(trace_file_or_default_stream, __VA_ARGS__); \
82-
fflush(trace_file_or_default_stream)
77+
#define ERPC_REORDER(...) \
78+
erpc_output_log_header(erpc_trace_file_or_default_stream, \
79+
ERPC_LOG_LEVEL_REORDER); \
80+
fprintf(erpc_trace_file_or_default_stream, __VA_ARGS__); \
81+
fflush(erpc_trace_file_or_default_stream)
8382
#else
8483
#define ERPC_REORDER(...) ((void)0)
8584
#endif
8685

8786
#if ERPC_LOG_LEVEL >= ERPC_LOG_LEVEL_TRACE
88-
#define ERPC_TRACE(...) \
89-
output_log_header(trace_file_or_default_stream, ERPC_LOG_LEVEL_TRACE); \
90-
fprintf(trace_file_or_default_stream, __VA_ARGS__); \
91-
fflush(trace_file_or_default_stream)
87+
#define ERPC_TRACE(...) \
88+
erpc_output_log_header(erpc_trace_file_or_default_stream, \
89+
ERPC_LOG_LEVEL_TRACE); \
90+
fprintf(erpc_trace_file_or_default_stream, __VA_ARGS__); \
91+
fflush(erpc_trace_file_or_default_stream)
9292
#else
9393
#define ERPC_TRACE(...) ((void)0)
9494
#endif
9595

9696
#if ERPC_LOG_LEVEL >= ERPC_LOG_LEVEL_CC
97-
#define ERPC_CC(...) \
98-
output_log_header(trace_file_or_default_stream, ERPC_LOG_LEVEL_CC); \
99-
fprintf(trace_file_or_default_stream, __VA_ARGS__); \
100-
fflush(trace_file_or_default_stream)
97+
#define ERPC_CC(...) \
98+
erpc_output_log_header(erpc_trace_file_or_default_stream, \
99+
ERPC_LOG_LEVEL_CC); \
100+
fprintf(erpc_trace_file_or_default_stream, __VA_ARGS__); \
101+
fflush(erpc_trace_file_or_default_stream)
101102
#else
102103
#define ERPC_CC(...) ((void)0)
103104
#endif
@@ -115,7 +116,7 @@ static std::string get_formatted_time() {
115116
}
116117

117118
// Output log message header
118-
static void output_log_header(FILE *stream, int level) {
119+
static void erpc_output_log_header(FILE *stream, int level) {
119120
std::string formatted_time = get_formatted_time();
120121

121122
const char *type;

0 commit comments

Comments
 (0)