diff options
| author | Stefan Boberg <[email protected]> | 2021-09-15 17:33:33 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-09-15 17:33:33 +0200 |
| commit | 5f53b41dd7438906a43fb8ebf6984efe89862970 (patch) | |
| tree | e6e50e2c12e14c0c0e52b7321243e4780b4c856a /zencore/include | |
| parent | Corrected logic error in ValidateCbPackageAttachment() (diff) | |
| download | zen-5f53b41dd7438906a43fb8ebf6984efe89862970.tar.xz zen-5f53b41dd7438906a43fb8ebf6984efe89862970.zip | |
Fixed logging.h so it doesn't leak `using namespace std::literals` declaration
Diffstat (limited to 'zencore/include')
| -rw-r--r-- | zencore/include/zencore/logging.h | 49 |
1 files changed, 41 insertions, 8 deletions
diff --git a/zencore/include/zencore/logging.h b/zencore/include/zencore/logging.h index 4eee20414..8e6b3a244 100644 --- a/zencore/include/zencore/logging.h +++ b/zencore/include/zencore/logging.h @@ -39,11 +39,44 @@ using zen::Log; // Helper macros for logging -using namespace std::literals; - -#define ZEN_TRACE(fmtstr, ...) Log().trace(fmtstr##sv, __VA_ARGS__) -#define ZEN_DEBUG(fmtstr, ...) Log().debug(fmtstr##sv, __VA_ARGS__) -#define ZEN_INFO(fmtstr, ...) Log().info(fmtstr##sv, __VA_ARGS__) -#define ZEN_WARN(fmtstr, ...) Log().warn(fmtstr##sv, __VA_ARGS__) -#define ZEN_ERROR(fmtstr, ...) Log().error(fmtstr##sv, __VA_ARGS__) -#define ZEN_CRITICAL(fmtstr, ...) Log().critical(fmtstr##sv, __VA_ARGS__) +#define ZEN_TRACE(fmtstr, ...) \ + do \ + { \ + using namespace std::literals; \ + Log().trace(fmtstr##sv, __VA_ARGS__); \ + } while (false) + +#define ZEN_DEBUG(fmtstr, ...) \ + do \ + { \ + using namespace std::literals; \ + Log().debug(fmtstr##sv, __VA_ARGS__); \ + } while (false) + +#define ZEN_INFO(fmtstr, ...) \ + do \ + { \ + using namespace std::literals; \ + Log().info(fmtstr##sv, __VA_ARGS__); \ + } while (false) + +#define ZEN_WARN(fmtstr, ...) \ + do \ + { \ + using namespace std::literals; \ + Log().warn(fmtstr##sv, __VA_ARGS__); \ + } while (false) + +#define ZEN_ERROR(fmtstr, ...) \ + do \ + { \ + using namespace std::literals; \ + Log().error(fmtstr##sv, __VA_ARGS__); \ + } while (false) + +#define ZEN_CRITICAL(fmtstr, ...) \ + do \ + { \ + using namespace std::literals; \ + Log().critical(fmtstr##sv, __VA_ARGS__); \ + } while (false) |