Skip to content

Commit

Permalink
Merge pull request #16 from ErezBinyamin/patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
hideakitai authored Oct 3, 2023
2 parents 9874696 + bf92ac2 commit 991cd1a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions DebugLogEnable.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
#define LOG_SHORT_FILENAME (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)

// C pre-proc Token Concatenation: https://wiki.sei.cmu.edu/confluence/display/c/PRE05-C.+Understand+macro+replacement+when+concatenating+tokens+or+performing+stringification
#define xstr(s) str(s)
#define str(s) #s
#define LOG_MACRO_APPEND_STR(s) LOG_HELPER_MACRO_APPEND_STR(s)
#define LOG_HELPER_MACRO_APPEND_STR(s) #s

#ifndef LOG_PREAMBLE
#define LOG_PREAMBLE LOG_SHORT_FILENAME, xstr(L.__LINE__), __func__, ":"
#define LOG_PREAMBLE LOG_SHORT_FILENAME, LOG_MACRO_APPEND_STR(L.__LINE__), __func__, ":"
#endif

#if defined(DEBUGLOG_DEFAULT_LOG_LEVEL_ERROR)
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,11 @@ LOG_INFO("Message 3");
The Default `LOG_PREAMBLE` calls other macros and functions. _Note_ the comma separated fields will be space delimeted as they are inputs to the `LOG_XXXX(...)` macro.
```C++
#define LOG_PREAMBLE LOG_SHORT_FILENAME, xstr(L.__LINE__), __func__, ":"
#define LOG_PREAMBLE LOG_SHORT_FILENAME, LOG_MACRO_APPEND_STR(L.__LINE__), __func__, ":"
```

> The `LOG_MACRO_APPEND_STR()` macro will append a string to the result of a second macro
### Assertion

`ASSERT` suspends program if the provided condition is `false`
Expand Down

0 comments on commit 991cd1a

Please sign in to comment.