diff options
| author | Stefan Boberg <[email protected]> | 2021-09-15 11:27:48 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-09-15 11:27:48 +0200 |
| commit | 2b9bed6635d95e15847c4d9b602e34d90e277d14 (patch) | |
| tree | 66fb191150ccbf9f56315a716abd23b25cc1d401 /zencore/logging.cpp | |
| parent | xmake: added zenhttp dependency to make zen CLI tool buld (diff) | |
| download | zen-2b9bed6635d95e15847c4d9b602e34d90e277d14.tar.xz zen-2b9bed6635d95e15847c4d9b602e34d90e277d14.zip | |
Changed logging implementation
* Code should no longer directly `#include spdlog/spdlog.h`, instead use `#include <zencore/logging.h>`
* Instead of explicit calls to `spdlog::info(...)` and such please use the logging macros defined in `zencore/logging.h`. I.e `ZEN_INFO`, `ZEN_DEBUG`, `ZEN_TRACE`, `ZEN_ERROR`, `ZEN_CRITITCAL`
* The macros will pick up the "most local" logger via a `Log()` call to retrieve a logger instance. To override the default logger in a class please implement your own `Log()` function
Diffstat (limited to 'zencore/logging.cpp')
| -rw-r--r-- | zencore/logging.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/zencore/logging.cpp b/zencore/logging.cpp index 6441fc3bc..9d5a726f5 100644 --- a/zencore/logging.cpp +++ b/zencore/logging.cpp @@ -4,6 +4,16 @@ #include <spdlog/sinks/stdout_color_sinks.h> +namespace zen { + +spdlog::logger& +Log() +{ + return *spdlog::default_logger(); +} + +} // namespace zen + namespace zen::logging { spdlog::logger& |