Skip to content

Instantly share code, notes, and snippets.

@linuskmr
Last active November 12, 2022 11:08
Show Gist options
  • Save linuskmr/7964102219b231471a3ecde1a03f74a7 to your computer and use it in GitHub Desktop.
Save linuskmr/7964102219b231471a3ecde1a03f74a7 to your computer and use it in GitHub Desktop.
Logging macro with file, line number and function name
/**
* 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