1) logging: channel(s) enabling made optionally less verbose; 2) various fixes after the merge
This commit is contained in:
parent
2c88652fbd
commit
b94c9f75d3
9 changed files with 17 additions and 19 deletions
|
|
@ -116,7 +116,7 @@ DISABLE_VS_WARNINGS(4100)
|
|||
|
||||
#define ENABLE_CHANNEL_BY_DEFAULT(ch_name) \
|
||||
static bool COMBINE(init_channel, __LINE__) UNUSED_ATTRIBUTE = epee::misc_utils::static_initializer([](){ \
|
||||
epee::log_space::log_singletone::enable_channel(ch_name); return true; \
|
||||
epee::log_space::log_singletone::enable_channel(ch_name, false); return true; \
|
||||
});
|
||||
|
||||
|
||||
|
|
@ -1239,21 +1239,24 @@ namespace log_space
|
|||
return genabled_channels.find(ch_name) != genabled_channels.end();
|
||||
}
|
||||
|
||||
static void enable_channels(const std::string& channels_set)
|
||||
static void enable_channels(const std::string& channels_set, bool verbose = true)
|
||||
{
|
||||
std::set<std::string>& genabled_channels = get_enabled_channels();
|
||||
std::list<std::string> list_of_channels;
|
||||
boost::split(list_of_channels, channels_set, boost::is_any_of(",;: "), boost::token_compress_on);
|
||||
std::cout << "log channels: ";
|
||||
if (verbose)
|
||||
std::cout << "log channels: ";
|
||||
for (const auto& ch : list_of_channels)
|
||||
{
|
||||
genabled_channels.insert(ch);
|
||||
std::cout << ch << " ";
|
||||
if (verbose)
|
||||
std::cout << ch << " ";
|
||||
}
|
||||
std::cout << " enabled" << std::endl;
|
||||
if (verbose)
|
||||
std::cout << " enabled" << std::endl;
|
||||
}
|
||||
|
||||
static void enable_channel(const std::string& ch_name)
|
||||
static void enable_channel(const std::string& ch_name, bool verbose = true)
|
||||
{
|
||||
std::set<std::string>& genabled_channels = get_enabled_channels();
|
||||
//lazy synchronization: just replace with modified copy of whole set
|
||||
|
|
@ -1261,7 +1264,8 @@ namespace log_space
|
|||
enabled_channels_local.insert(ch_name);
|
||||
genabled_channels.swap(enabled_channels_local);
|
||||
#ifndef ANDROID_BUILD
|
||||
//std::cout << "log channel '" << ch_name << "' enabled" << std::endl;
|
||||
if (verbose)
|
||||
std::cout << "log channel '" << ch_name << "' enabled" << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -578,7 +578,7 @@ namespace currency
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
bool get_tx_fee(const transaction& tx, uint64_t & fee)
|
||||
bool get_tx_fee(const transaction& tx, uint64_t& fee)
|
||||
{
|
||||
fee = 0;
|
||||
if (is_coinbase(tx))
|
||||
|
|
@ -607,10 +607,8 @@ namespace currency
|
|||
return true; // continue
|
||||
};
|
||||
|
||||
|
||||
bool r = process_type_in_variant_container<zarcanum_tx_data_v1>(tx.extra, cb, false);
|
||||
|
||||
|
||||
if (!r)
|
||||
{
|
||||
fee = 0;
|
||||
|
|
|
|||
|
|
@ -218,7 +218,6 @@ namespace currency
|
|||
catch(...)
|
||||
{
|
||||
// should never go here, just precaution
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ int main(int argc, char* argv[])
|
|||
#endif
|
||||
log_space::get_set_log_detalisation_level(true, LOG_LEVEL_0);
|
||||
log_space::log_singletone::add_logger(LOGGER_CONSOLE, NULL, NULL);
|
||||
log_space::log_singletone::enable_channels("core,currency_protocol,tx_pool,wallet");
|
||||
log_space::log_singletone::enable_channels("core,currency_protocol,tx_pool,wallet", false);
|
||||
LOG_PRINT_L0("Starting...");
|
||||
|
||||
tools::signal_handler::install_fatal([](int sig_number, void* address) {
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ namespace plain_wallet
|
|||
log_dir += "/" LOGS_FOLDER;
|
||||
|
||||
log_space::get_set_need_thread_id(true, true);
|
||||
log_space::log_singletone::enable_channels("core,currency_protocol,tx_pool,p2p,wallet");
|
||||
log_space::log_singletone::enable_channels("core,currency_protocol,tx_pool,p2p,wallet", false);
|
||||
epee::log_space::get_set_log_detalisation_level(true, log_level);
|
||||
#ifdef ANDROID_BUILD
|
||||
epee::log_space::log_singletone::add_logger(new android_logger());
|
||||
|
|
|
|||
|
|
@ -252,9 +252,6 @@ namespace tools
|
|||
const currency::tx_destination_entry& change_dst, uint64_t dust_threshold,
|
||||
std::vector<currency::tx_destination_entry>& splitted_dsts, uint64_t& dust, uint64_t max_output_allowed)
|
||||
{
|
||||
//&&&&&
|
||||
LOG_PRINT_MAGENTA("[--apply_split_strategy_by_id, split strtegy_id: " << id, LOG_LEVEL_0);
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case ssi_digit:
|
||||
|
|
|
|||
|
|
@ -658,7 +658,7 @@ int main(int argc, char* argv[])
|
|||
log_space::log_singletone::get_default_log_file().c_str(),
|
||||
log_space::log_singletone::get_default_log_folder().c_str());
|
||||
|
||||
log_space::log_singletone::enable_channels("core,currency_protocol,tx_pool,p2p,wallet");
|
||||
log_space::log_singletone::enable_channels("core,currency_protocol,tx_pool,p2p,wallet", false);
|
||||
|
||||
tools::signal_handler::install_fatal([](int sig_number, void* address) {
|
||||
LOG_ERROR("\n\nFATAL ERROR\nsig: " << sig_number << ", address: " << address);
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ TEST(ml2s, hs)
|
|||
x = 0;
|
||||
|
||||
crypto::hash h;
|
||||
scalar_t r;
|
||||
//scalar_t r;
|
||||
|
||||
sha3(0, 0, &h, sizeof h);
|
||||
LOG_PRINT("SHA3() -> " << h, LOG_LEVEL_0);
|
||||
|
|
|
|||
|
|
@ -986,7 +986,7 @@ namespace db_test
|
|||
bool r = false;
|
||||
epee::shared_recursive_mutex rw_lock;
|
||||
|
||||
epee::log_space::log_singletone::enable_channels("lmdb");
|
||||
epee::log_space::log_singletone::enable_channels("lmdb", false);
|
||||
|
||||
static const uint64_t buffer_size = 64 * 1024; // 64 KB
|
||||
static const uint64_t db_total_size = static_cast<uint64_t>(2.1 * 1024 * 1024 * 1024); // 2.1 GB -- a bit more than 2GB to test 2GB boundary
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue