00001 #ifndef EZLOGGER_MACROS_HPP_HEADER_GRD_
00002 #define EZLOGGER_MACROS_HPP_HEADER_GRD_
00003
00012 #if defined(_DEBUG) || defined(_DEBUG_)
00013
00020 #define EZLOGGER_IMPLEMENT_DEBUGLOGGING
00021 #endif
00022
00048
00049 #if !defined(__FUNCTION__) && !defined(__GNUC__) //The GNU compiler and VC++ 7.x supports this macro
00050 #define __FUNCTION__ "" //If compiler does not support it, then use empty string
00051 #endif
00052 // @endcond
00053
00056
00058
00059
00074 #define EZLOGGER axter::ezlogger<>(__FILE__, __LINE__, __FUNCTION__)
00075
00087 #define EZLOGGERSTREAM axter::ezlogger<>(__FILE__, __LINE__, __FUNCTION__, axter::log_default_verbosity_level, true)
00088
00100 #define EZLOGGERSTREAM2(alterante_stream) axter::ezlogger<>(__FILE__, __LINE__, __FUNCTION__, axter::log_default_verbosity_level, true, &alterante_stream)
00101
00113 #define EZLOGGERPRINT axter::ezlogger<>(__FILE__, __LINE__, __FUNCTION__).cprint
00114
00128 #ifdef EZLOGGER_IMPLEMENT_DEBUGLOGGING
00129 #define EZLOGGERVARIFY(x) assert(axter::ezlogger<>(__FILE__, __LINE__, __FUNCTION__, axter::log_default_verbosity_level).log_if_fails_verification((x), #x))
00130 #else
00131 #define EZLOGGERVARIFY(x) axter::ezlogger<>(__FILE__, __LINE__, __FUNCTION__, axter::log_default_verbosity_level).log_if_fails_verification((x), #x)
00132 #endif
00133
00150 #define EZLOGGERVAR(x) axter::ezlogger<>(__FILE__, __LINE__, __FUNCTION__)(axter::ezlogger<>::to_str(#x) + axter::ezlogger<>::to_str(" = '") + axter::ezlogger<>::to_str(x) + axter::ezlogger<>::to_str("'")), x
00151
00165 #define EZLOGGERMARKER axter::ezlogger<>(__FILE__, __LINE__, __FUNCTION__)("marker")
00166
00182 #define EZLOGGERFUNCTRACKER axter::ezfunction_tracker my_function_tracker##__LINE__(__FILE__, __LINE__, __FUNCTION__)
00183
00200 #define EZLOGGERDISPLAY_STACK axter::ezlogger<>(__FILE__, __LINE__, __FUNCTION__).display_stack();
00201
00215 #define EZLOGGER_PRG_MAIN_ARG(argc, argv) axter::ezlogger<>(__FILE__, __LINE__, __FUNCTION__).prg_main_arg(argc, argv)
00216
00217
00220
00222
00223
00238 #define EZLOGGERVL(verbosity_level) axter::ezlogger<>(__FILE__, __LINE__, __FUNCTION__, verbosity_level)
00239
00251 #define EZLOGGERVLSTREAM(verbosity_level) axter::ezlogger<>(__FILE__, __LINE__, __FUNCTION__, verbosity_level, true)
00252
00264 #define EZLOGGERVLSTREAM2(verbosity_level, alterante_stream) axter::ezlogger<>(__FILE__, __LINE__, __FUNCTION__, verbosity_level, true, &alterante_stream)
00265
00277 #define EZLOGGERVLPRINT(verbosity_level) axter::ezlogger<>(__FILE__, __LINE__, __FUNCTION__, verbosity_level).cprint
00278
00292 #ifdef EZLOGGER_IMPLEMENT_DEBUGLOGGING
00293 #define EZLOGGERVLVARIFY(verbosity_level, x) assert(axter::ezlogger<>(__FILE__, __LINE__, __FUNCTION__, verbosity_level).log_if_fails_verification((x), #x))
00294 #else
00295 #define EZLOGGERVLVARIFY(verbosity_level, x) axter::ezlogger<>(__FILE__, __LINE__, __FUNCTION__, verbosity_level).log_if_fails_verification((x), #x)
00296 #endif
00297
00314 #define EZLOGGERVLVAR(verbosity_level, x) axter::ezlogger<>(__FILE__, __LINE__, __FUNCTION__, verbosity_level)(axter::ezlogger<>::to_str(#x) + axter::ezlogger<>::to_str(" = '") + axter::ezlogger<>::to_str(x) + axter::ezlogger<>::to_str("'")),x
00315
00329 #define EZLOGGERVLMARKER(verbosity_level) axter::ezlogger<>(__FILE__, __LINE__, __FUNCTION__, verbosity_level)("marker")
00330
00346 #define EZLOGGERVLFUNCTRACKER(verbosity_level) axter::ezfunction_tracker my_function_tracker##__LINE__(__FILE__, __LINE__, __FUNCTION__, verbosity_level)
00347
00364 #define EZLOGGERVLDISPLAY_STACK(verbosity_level) axter::ezlogger<>(__FILE__, __LINE__, __FUNCTION__, verbosity_level).display_stack();
00365
00379 #define EZLOGGERVL_PRG_MAIN_ARG(verbosity_level, argc, argv) axter::ezlogger<>(__FILE__, __LINE__, __FUNCTION__, verbosity_level).prg_main_arg(argc, argv)
00380
00381
00382
00385
00388 #ifdef EZLOGGER_IMPLEMENT_DEBUGLOGGING
00391
00393
00394
00395
00406 #define EZDBGONLYLOGGER axter::ezlogger<>(__FILE__, __LINE__, __FUNCTION__)
00407
00415 #define EZDBGONLYLOGGERSTREAM axter::ezlogger<>(__FILE__, __LINE__, __FUNCTION__, axter::log_default_verbosity_level, true)
00416
00427 #define EZDBGONLYLOGGERSTREAM2(alterante_stream) axter::ezlogger<>(__FILE__, __LINE__, __FUNCTION__, axter::log_default_verbosity_level, true, &alterante_stream)
00428
00436 #define EZDBGONLYLOGGERPRINT axter::ezlogger<>(__FILE__, __LINE__, __FUNCTION__).cprint
00437
00450 #define EZDBGONLYLOGGERVAR(x) axter::ezlogger<>(__FILE__, __LINE__, __FUNCTION__)(axter::ezlogger<>::to_str(#x) + axter::ezlogger<>::to_str(" = '") + axter::ezlogger<>::to_str(x) + axter::ezlogger<>::to_str("'"))
00451
00461 #define EZDBGONLYLOGGERMARKER axter::ezlogger<>(__FILE__, __LINE__, __FUNCTION__)("marker")
00462
00479 #define EZDBGONLYLOGGERFUNCTRACKER axter::ezfunction_tracker my_function_tracker##__LINE__(__FILE__, __LINE__, __FUNCTION__)
00480
00497 #define EZDBGONLYLOGGERDISPLAY_STACK axter::ezlogger<>(__FILE__, __LINE__, __FUNCTION__).display_stack();
00498
00508 #define EZDBGONLYLOGGER_PRG_MAIN_ARG(argc, argv) axter::ezlogger<>(__FILE__, __LINE__, __FUNCTION__).prg_main_arg(argc, argv)
00509
00510
00511
00514
00516
00517
00529 #define EZDBGONLYLOGGERVL(verbosity_level) axter::ezlogger<>(__FILE__, __LINE__, __FUNCTION__, verbosity_level)
00530
00539 #define EZDBGONLYLOGGERVLSTREAM(verbosity_level) axter::ezlogger<>(__FILE__, __LINE__, __FUNCTION__, verbosity_level, true)
00540
00549 #define EZDBGONLYLOGGERVLSTREAM2(verbosity_level, alterante_stream) axter::ezlogger<>(__FILE__, __LINE__, __FUNCTION__, verbosity_level, true, &alterante_stream)
00550
00559 #define EZDBGONLYLOGGERVLPRINT(verbosity_level) axter::ezlogger<>(__FILE__, __LINE__, __FUNCTION__, verbosity_level).cprint
00560
00574 #define EZDBGONLYLOGGERVLVAR(verbosity_level, x) axter::ezlogger<>(__FILE__, __LINE__, __FUNCTION__, verbosity_level)(axter::ezlogger<>::to_str(#x) + axter::ezlogger<>::to_str(" = '") + axter::ezlogger<>::to_str(x) + axter::ezlogger<>::to_str("'")),x
00575
00586 #define EZDBGONLYLOGGERVLMARKER(verbosity_level) axter::ezlogger<>(__FILE__, __LINE__, __FUNCTION__, verbosity_level)("marker")
00587
00600 #define EZDBGONLYLOGGERVLFUNCTRACKER(verbosity_level) axter::ezfunction_tracker my_function_tracker##__LINE__(__FILE__, __LINE__, __FUNCTION__, verbosity_level)
00601
00615 #define EZDBGONLYLOGGERVLDISPLAY_STACK(verbosity_level) axter::ezlogger<>(__FILE__, __LINE__, __FUNCTION__, verbosity_level).display_stack();
00616
00627 #define EZDBGONLYLOGGERVL_PRG_MAIN_ARG(verbosity_level, argc, argv) axter::ezlogger<>(__FILE__, __LINE__, __FUNCTION__, verbosity_level).prg_main_arg(argc, argv)
00628
00629
00630
00631 #else //EZLOGGER_IMPLEMENT_DEBUGLOGGING
00632
00633 #define EZDBGONLYLOGGER if (1);else
00634 #define EZDBGONLYLOGGERSTREAM if (1);else std::cout
00635 #define EZDBGONLYLOGGERSTREAM2(alterante_stream) if (1);else std::cout
00636 #define EZDBGONLYLOGGERPRINT if (1);else
00637 #define EZDBGONLYLOGGERVAR(x)
00638 #define EZDBGONLYLOGGERMARKER
00639 #define EZDBGONLYLOGGERFUNCTRACKER
00640 #define EZDBGONLYLOGGERDISPLAY_STACK
00641 #define EZDBGONLYLOGGER_PRG_MAIN_ARG(argc, argv)
00642
00643 #define EZDBGONLYLOGGERVL(verbosity_level) if (1);else std::cout
00644 #define EZDBGONLYLOGGERVLSTREAM(verbosity_level) if (1);else std::cout
00645 #define EZDBGONLYLOGGERVLSTREAM2(verbosity_level, alterante_stream) if (1);else std::cout
00646 #define EZDBGONLYLOGGERVLPRINT(verbosity_level) if (1);else
00647 #define EZDBGONLYLOGGERVLVAR(verbosity_level, x)
00648 #define EZDBGONLYLOGGERVLMARKER(verbosity_level)
00649 #define EZDBGONLYLOGGERVLFUNCTRACKER(verbosity_level)
00650 #define EZDBGONLYLOGGERVLDISPLAY_STACK(verbosity_level)
00651 #define EZDBGONLYLOGGERVL_PRG_MAIN_ARG(verbosity_level, argc, argv)
00652
00653 #endif //EZLOGGER_IMPLEMENT_DEBUGLOGGING
00654
00655 #ifdef _WIN32
00656
00669 #define EZLOGGER_BEEP_AND_SLEEP(qty_seconds) Beep(100, 300);Beep(50, 300);Sleep((qty_seconds/2)*1000);Beep(50, 300);Sleep((qty_seconds/2)*1000);Beep(50, 200);Beep(50, 200);Beep(50, 400);EZLOGGER("BeepAndSleep")
00670 #endif //_WIN32
00671
00678 #endif //EZLOGGER_MACROS_HPP_HEADER_GRD_