-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlog.h
31 lines (26 loc) · 1.34 KB
/
log.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
* This header just simulate some OCK log macros to minimize effort to reuse
* code
*/
#ifndef LOG_H
#define LOG_H
#include <stdlib.h>
#include <stdio.h>
#define OCK_LOG_DEBUG(fmt, ...) \
do { \
if (getenv("ICSF_DEBUG")) { \
fprintf(stderr, "----------------------------------------" \
"---------------------------------------\n" \
"%s() @ %s:%d\n" fmt, __FUNCTION__, __FILE__, \
__LINE__, ##__VA_ARGS__); \
} \
} while (0)
#define OCK_LOG_ERR(err) \
do { \
if (getenv("ICSF_DEBUG")) { \
OCK_LOG_DEBUG("Error: " #err "\n"); \
} else { \
fprintf(stderr, "Error: " #err "\n"); \
} \
} while (0)
#endif