Last active
November 12, 2022 11:08
-
-
Save linuskmr/7964102219b231471a3ecde1a03f74a7 to your computer and use it in GitHub Desktop.
Logging macro with file, line number and function name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A macro that works like printf, but prints to stderr and includes the file, line number and function name. | |
* From https://bitsector.net/useful-logging-macro/ | |
*/ | |
#define LOG(...) printf("%s:%d %s(): ", __FILE_NAME__, __LINE__, __func__);\ | |
printf(__VA_ARGS__); \ | |
printf("\r\n"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment