Skip to content

Instantly share code, notes, and snippets.

@dorgonman
Last active March 26, 2016 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dorgonman/575f2e4a3c78621bcff8 to your computer and use it in GitHub Desktop.
Save dorgonman/575f2e4a3c78621bcff8 to your computer and use it in GitHub Desktop.
usage_horizon_log
static class HorizonDevNull
{
} horizon_dev_null;
//BOOST_LOG_FUNCTION()
//BOOST_LOG_FUNCTION()
#define HORIZON_LOG_FUNCTION " [" << __FILE__ << "(" << __LINE__ << ")" << ": " << BOOST_CURRENT_FUNCTION << "] "
#if defined(NDEBUG) || defined(_NDEBUG)
template <typename T>
HorizonDevNull & operator<<(HorizonDevNull & dest, T)
{
return dest;
}
#define HORIZON_TRACE horizon_dev_null
#else
#define HORIZON_TRACE BOOST_LOG_TRIVIAL(trace) << HORIZON_LOG_FUNCTION << "\n"
#endif
#define HORIZON_DEBUG BOOST_LOG_TRIVIAL(debug) << HORIZON_LOG_FUNCTION << "\n"
#define HORIZON_INFO BOOST_LOG_TRIVIAL(info) << HORIZON_LOG_FUNCTION << "\n"
#define HORIZON_WARNING BOOST_LOG_TRIVIAL(warning) << HORIZON_LOG_FUNCTION << "\n"
#define HORIZON_ERROR BOOST_LOG_TRIVIAL(error) << HORIZON_LOG_FUNCTION << "\n"
#define HORIZON_FATAL BOOST_LOG_TRIVIAL(fatal) << HORIZON_LOG_FUNCTION << "\n"
==============================================================
HORIZON_INFO << "HELLO WORLD!!!";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment