Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Stefan Hackenberg
mbed-logger
Commits
8f86b215
Commit
8f86b215
authored
Oct 06, 2021
by
Stefan Hackenberg
Browse files
Add function name to log output
parent
fda8f6a5
Changes
1
Hide whitespace changes
Inline
Side-by-side
logger.h
View file @
8f86b215
...
...
@@ -22,15 +22,15 @@
// Genuine definitions
#if defined(LOG_LEVEL_TRACE)
#define TRACE(x, ...) std::printf("[TRACE: %s:%d] " x "\r\n", __FILE__, __LINE__, ##__VA_ARGS__);
#define TRACE(x, ...) std::printf("[TRACE:
%s()
%s:%d] " x "\r\n",
__FUNCTION__,
__FILE__, __LINE__, ##__VA_ARGS__);
#else
#define TRACE(x, ...)
#endif
#if defined(LOG_LEVEL_DEBUG)
#define DEBUG(x, ...) std::printf("[DEBUG: %s:%d] " x "\r\n", __FILE__, __LINE__, ##__VA_ARGS__);
#define DEBUG(x, ...) std::printf("[DEBUG:
%s()
%s:%d] " x "\r\n",
__FUNCTION__,
__FILE__, __LINE__, ##__VA_ARGS__);
#define DEBUGARRAY(buffer, length, x, ...) \
std::printf("[DEBUG: %s:%d] " x " ", __FILE__, __LINE__, ##__VA_ARGS__); \
std::printf("[DEBUG:
%s()
%s:%d] " x " ",
__FUNCTION__,
__FILE__, __LINE__, ##__VA_ARGS__); \
printfhex(buffer, length)
#else
#define DEBUG(x, ...)
...
...
@@ -38,19 +38,19 @@
#endif
#if defined(LOG_LEVEL_INFO)
#define INFO(x, ...) std::printf("[INFO: %s:%d] " x "\r\n", __FILE__, __LINE__, ##__VA_ARGS__);
#define INFO(x, ...) std::printf("[INFO:
%s()
%s:%d] " x "\r\n",
__FUNCTION__,
__FILE__, __LINE__, ##__VA_ARGS__);
#else
#define INFO(x, ...)
#endif
#if defined(LOG_LEVEL_WARN)
#define WARN(x, ...) std::printf("[WARN: %s:%d] " x "\r\n", __FILE__, __LINE__, ##__VA_ARGS__);
#define WARN(x, ...) std::printf("[WARN:
%s()
%s:%d] " x "\r\n",
__FUNCTION__,
__FILE__, __LINE__, ##__VA_ARGS__);
#else
#define WARN(x, ...)
#endif
#if defined(LOG_LEVEL_ERROR)
#define ERROR(x, ...) std::printf("[ERROR: %s:%d] " x "\r\n", __FILE__, __LINE__, ##__VA_ARGS__);
#define ERROR(x, ...) std::printf("[ERROR:
%s()
%s:%d] " x "\r\n",
__FUNCTION__,
__FILE__, __LINE__, ##__VA_ARGS__);
#else
#define ERROR(x, ...)
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment