diff options
| author | thecharlesblake | 2017-10-11 11:30:29 +0100 |
|---|---|---|
| committer | thecharlesblake | 2017-10-13 18:46:14 +0100 |
| commit | 6132bc9f3a8b7ce9dc1a17dd027166170697943b (patch) | |
| tree | 292ed62e905281f18003fa5bfcb2b77f0fd7fbd3 /src | |
| parent | Add basic logging to project (diff) | |
| download | metasol-6132bc9f3a8b7ce9dc1a17dd027166170697943b.tar.gz metasol-6132bc9f3a8b7ce9dc1a17dd027166170697943b.zip | |
Add logging macros
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/main.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/main/main.cpp b/src/main/main.cpp index 54bc493..3b4b00b 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -3,16 +3,21 @@ #include <boost/foreach.hpp> #include <boost/log/trivial.hpp> -namespace logging = boost::log; +#if defined NDEBUG + #define LOG_DEBUG(msg) +#else + #define LOG_DEBUG(msg) BOOST_LOG_TRIVIAL(debug) << msg +#endif +#define LOG_INFO(msg) BOOST_LOG_TRIVIAL(info) << msg +#define LOG_WARNING(msg) BOOST_LOG_TRIVIAL(warning) << msg +#define LOG_ERROR(msg) BOOST_LOG_ERROR(error) << msg int main() { -#ifndef NDEBUG - BOOST_LOG_TRIVIAL(debug) << "Log debug"; -#endif - BOOST_LOG_TRIVIAL(info) << "Log info"; - BOOST_LOG_TRIVIAL(warning) << "Log warning"; + LOG_DEBUG("Log debug"); + LOG_INFO("Log info"); + LOG_WARNING("Log warning"); std::string hello( "Hello, world!\n" ); |
