forked from taktod/ttLibJsGyp2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
log.h
48 lines (40 loc) · 853 Bytes
/
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**
* @file log.h
* @brief log support.
*
* this code is under 3-Cause BSD license.
*
* @author taktod
* @date 2015/07/12
*/
#ifndef TTLIBC_LOG_H_
#define TTLIBC_LOG_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#ifndef __DEBUG_FLAG__
# define __DEBUG_FLAG__ 0
#endif
/**
* output log data. only for debug compile
* @param fmt format string
* @param ... data for format string
*/
#if __DEBUG_FLAG__ == 1
# define LOG_PRINT(fmt, ...) \
printf("[log]%s(): " fmt "\n", __func__, ## __VA_ARGS__)
#else
# define LOG_PRINT(fmt, ...)
#endif
/**
* output error data for strerr.
* @param fmt format string
* @param ... data for format string
*/
#define ERR_PRINT(fmt, ...) \
fprintf(stderr, "[log]%s(): " fmt "\n", __func__, ## __VA_ARGS__)
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* TTLIBC_LOG_H_ */