-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlog.h
More file actions
25 lines (21 loc) · 1.02 KB
/
Copy pathlog.h
File metadata and controls
25 lines (21 loc) · 1.02 KB
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
/*****************************************************************//**
* \file log.h
* \brief Custom LOG() macro to print location of the function call
* with __VA_ARGS__ and fprintf() in C.
*
* \author Xuhua Huang
* \date October 2021
*********************************************************************/
#ifndef LOG_H
#define LOG_H
#ifndef _STDIO_H
#include <stdio.h>
#endif
/* Global Macro Definition */
#define LOG(...) \
{ \
fprintf(stderr, "%s, line %d: ", __FILE__, __LINE__); \
fprintf(stderr, __VA_ARGS__); \
fprintf(stderr, "\n"); \
}
#endif