Skip to content

Commit 2150b3c

Browse files
committed
Create log.h
1 parent 998ff70 commit 2150b3c

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Util/log.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*****************************************************************//**
2+
* \file log.h
3+
* \brief Custom LOG() macro to print location of the function call
4+
* with __VA_ARGS__ and fprintf() in C.
5+
*
6+
* \author Xuhua Huang
7+
* \date October 2021
8+
*********************************************************************/
9+
10+
#ifndef LOG_H
11+
#define LOG_H
12+
13+
#include <stdio.h>
14+
15+
/* Global Macro Definition */
16+
#define LOG(...) {\
17+
fprintf(stderr, "%s: Line %d:\t", __FILE__, __LINE__);\
18+
fprintf(stderr, __VA_ARGS__);\
19+
fprintf(stderr, "\n");\
20+
}
21+
22+
#endif

0 commit comments

Comments
 (0)