mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-23 18:47:36 -07:00
epee: make log macros behave like statements
In particular, make this kind of thing do what one expects it to do: if (x) LOG_PRINT("True"); else LOG_PRINT("No");
This commit is contained in:
parent
3f2970fadb
commit
760331b427
@ -1316,52 +1316,52 @@ POP_WARNINGS
|
|||||||
|
|
||||||
#if defined(ENABLE_LOGGING_INTERNAL)
|
#if defined(ENABLE_LOGGING_INTERNAL)
|
||||||
|
|
||||||
#define LOG_PRINT_NO_PREFIX2(log_name, x, y) {if ( y <= epee::log_space::log_singletone::get_log_detalisation_level() )\
|
#define LOG_PRINT_NO_PREFIX2(log_name, x, y) do {if ( y <= epee::log_space::log_singletone::get_log_detalisation_level() )\
|
||||||
{std::stringstream ss________; ss________ << x << std::endl; epee::log_space::log_singletone::do_log_message(ss________.str() , y, epee::log_space::console_color_default, false, log_name);}}
|
{std::stringstream ss________; ss________ << x << std::endl; epee::log_space::log_singletone::do_log_message(ss________.str() , y, epee::log_space::console_color_default, false, log_name);}} while(0)
|
||||||
|
|
||||||
#define LOG_PRINT_NO_PREFIX_NO_POSTFIX2(log_name, x, y) {if ( y <= epee::log_space::log_singletone::get_log_detalisation_level() )\
|
#define LOG_PRINT_NO_PREFIX_NO_POSTFIX2(log_name, x, y) do {if ( y <= epee::log_space::log_singletone::get_log_detalisation_level() )\
|
||||||
{std::stringstream ss________; ss________ << x; epee::log_space::log_singletone::do_log_message(ss________.str(), y, epee::log_space::console_color_default, false, log_name);}}
|
{std::stringstream ss________; ss________ << x; epee::log_space::log_singletone::do_log_message(ss________.str(), y, epee::log_space::console_color_default, false, log_name);}} while(0)
|
||||||
|
|
||||||
|
|
||||||
#define LOG_PRINT_NO_POSTFIX2(log_name, x, y) {if ( y <= epee::log_space::log_singletone::get_log_detalisation_level() )\
|
#define LOG_PRINT_NO_POSTFIX2(log_name, x, y) do {if ( y <= epee::log_space::log_singletone::get_log_detalisation_level() )\
|
||||||
{std::stringstream ss________; ss________ << epee::log_space::log_singletone::get_prefix_entry() << x; epee::log_space::log_singletone::do_log_message(ss________.str(), y, epee::log_space::console_color_default, false, log_name);}}
|
{std::stringstream ss________; ss________ << epee::log_space::log_singletone::get_prefix_entry() << x; epee::log_space::log_singletone::do_log_message(ss________.str(), y, epee::log_space::console_color_default, false, log_name);}} while(0)
|
||||||
|
|
||||||
|
|
||||||
#define LOG_PRINT2(log_name, x, y) {if ( y <= epee::log_space::log_singletone::get_log_detalisation_level() )\
|
#define LOG_PRINT2(log_name, x, y) do {if ( y <= epee::log_space::log_singletone::get_log_detalisation_level() )\
|
||||||
{std::stringstream ss________; ss________ << epee::log_space::log_singletone::get_prefix_entry() << x << std::endl;epee::log_space::log_singletone::do_log_message(ss________.str(), y, epee::log_space::console_color_default, false, log_name);}}
|
{std::stringstream ss________; ss________ << epee::log_space::log_singletone::get_prefix_entry() << x << std::endl;epee::log_space::log_singletone::do_log_message(ss________.str(), y, epee::log_space::console_color_default, false, log_name);}} while(0)
|
||||||
|
|
||||||
#define LOG_PRINT_COLOR2(log_name, x, y, color) {if ( y <= epee::log_space::log_singletone::get_log_detalisation_level() )\
|
#define LOG_PRINT_COLOR2(log_name, x, y, color) do {if ( y <= epee::log_space::log_singletone::get_log_detalisation_level() )\
|
||||||
{std::stringstream ss________; ss________ << epee::log_space::log_singletone::get_prefix_entry() << x << std::endl;epee::log_space::log_singletone::do_log_message(ss________.str(), y, color, false, log_name);}}
|
{std::stringstream ss________; ss________ << epee::log_space::log_singletone::get_prefix_entry() << x << std::endl;epee::log_space::log_singletone::do_log_message(ss________.str(), y, color, false, log_name);}} while(0)
|
||||||
|
|
||||||
|
|
||||||
#define LOG_PRINT2_JORNAL(log_name, x, y) {if ( y <= epee::log_space::log_singletone::get_log_detalisation_level() )\
|
#define LOG_PRINT2_JORNAL(log_name, x, y) do {if ( y <= epee::log_space::log_singletone::get_log_detalisation_level() )\
|
||||||
{std::stringstream ss________; ss________ << epee::log_space::log_singletone::get_prefix_entry() << x << std::endl;epee::log_space::log_singletone::do_log_message(ss________.str(), y, epee::log_space::console_color_default, true, log_name);}}
|
{std::stringstream ss________; ss________ << epee::log_space::log_singletone::get_prefix_entry() << x << std::endl;epee::log_space::log_singletone::do_log_message(ss________.str(), y, epee::log_space::console_color_default, true, log_name);}} while(0)
|
||||||
|
|
||||||
|
|
||||||
#define LOG_ERROR2(log_name, x) { \
|
#define LOG_ERROR2(log_name, x) do { \
|
||||||
std::stringstream ss________; ss________ << epee::log_space::log_singletone::get_prefix_entry() << "ERROR " << __FILE__ << ":" << __LINE__ << " " << x << std::endl; epee::log_space::log_singletone::do_log_message(ss________.str(), LOG_LEVEL_0, epee::log_space::console_color_red, true, log_name);LOCAL_ASSERT(0); epee::log_space::log_singletone::get_set_err_count(true, epee::log_space::log_singletone::get_set_err_count()+1);}
|
std::stringstream ss________; ss________ << epee::log_space::log_singletone::get_prefix_entry() << "ERROR " << __FILE__ << ":" << __LINE__ << " " << x << std::endl; epee::log_space::log_singletone::do_log_message(ss________.str(), LOG_LEVEL_0, epee::log_space::console_color_red, true, log_name);LOCAL_ASSERT(0); epee::log_space::log_singletone::get_set_err_count(true, epee::log_space::log_singletone::get_set_err_count()+1);} while(0)
|
||||||
|
|
||||||
#define LOG_FRAME2(log_name, x, y) epee::log_space::log_frame frame(x, y, log_name)
|
#define LOG_FRAME2(log_name, x, y) epee::log_space::log_frame frame(x, y, log_name)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
|
||||||
#define LOG_PRINT_NO_PREFIX2(log_name, x, y)
|
#define LOG_PRINT_NO_PREFIX2(log_name, x, y) ((void)0)
|
||||||
|
|
||||||
#define LOG_PRINT_NO_PREFIX_NO_POSTFIX2(log_name, x, y)
|
#define LOG_PRINT_NO_PREFIX_NO_POSTFIX2(log_name, x, y) ((void)0)
|
||||||
|
|
||||||
#define LOG_PRINT_NO_POSTFIX2(log_name, x, y)
|
#define LOG_PRINT_NO_POSTFIX2(log_name, x, y) ((void)0)
|
||||||
|
|
||||||
#define LOG_PRINT_COLOR2(log_name, x, y, color)
|
#define LOG_PRINT_COLOR2(log_name, x, y, color) ((void)0)
|
||||||
|
|
||||||
#define LOG_PRINT2_JORNAL(log_name, x, y)
|
#define LOG_PRINT2_JORNAL(log_name, x, y) ((void)0)
|
||||||
|
|
||||||
#define LOG_PRINT2(log_name, x, y)
|
#define LOG_PRINT2(log_name, x, y) ((void)0)
|
||||||
|
|
||||||
#define LOG_ERROR2(log_name, x)
|
#define LOG_ERROR2(log_name, x) ((void)0)
|
||||||
|
|
||||||
|
|
||||||
#define LOG_FRAME2(log_name, x, y)
|
#define LOG_FRAME2(log_name, x, y) ((void)0)
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user