aboutsummaryrefslogtreecommitdiff
path: root/src/blockchain_utilities/blocksdat_file.cpp
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-01-15 20:31:16 -0500
committerRiccardo Spagni <ric@spagni.net>2017-01-15 20:31:16 -0500
commitac7df193ca47261c2dfd91b230489e20955013a2 (patch)
treee4d312059948a0528583e7ea58d2c0b40307a494 /src/blockchain_utilities/blocksdat_file.cpp
parentMerge pull request #1578 (diff)
parentChange logging to easylogging++ (diff)
downloadmonero-ac7df193ca47261c2dfd91b230489e20955013a2.tar.xz
Merge pull request #1522
5833d66f Change logging to easylogging++ (moneromooo-monero) dc98019b easylogging++: fix logging with static const header only data members (moneromooo-monero) 3b46617b easylogging++: add ELPP_DISABLE_CHECK_MACROS (moneromooo-monero) 6fe39d90 easylogging++: allow clipping a common filename prefix (moneromooo-monero) 43abf6ff easylogging++: add file-only logs (moneromooo-monero) c313bea4 eayslogging++: Fix bad memory access before opening any files (moneromooo-monero) 0af5d168 easylogging++: avoid creating directory/filename for the builtin default log file (moneromooo-monero) 28362847 easylogging++: allow setting thread names (moneromooo-monero) ec71ce8d easylogging++: Print thread ID in a nicer way (moneromooo-monero) 2a0bf783 easylogging++: Add logging categories (moneromooo-monero) c50bbbfe easylogging++: import upstream (moneromooo-monero)
Diffstat (limited to 'src/blockchain_utilities/blocksdat_file.cpp')
-rw-r--r--src/blockchain_utilities/blocksdat_file.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/blockchain_utilities/blocksdat_file.cpp b/src/blockchain_utilities/blocksdat_file.cpp
index 926562ba2..7ccb9a145 100644
--- a/src/blockchain_utilities/blocksdat_file.cpp
+++ b/src/blockchain_utilities/blocksdat_file.cpp
@@ -28,6 +28,8 @@
#include "blocksdat_file.h"
+#undef MONERO_DEFAULT_LOG_CATEGORY
+#define MONERO_DEFAULT_LOG_CATEGORY "bcutil"
namespace po = boost::program_options;
@@ -50,7 +52,7 @@ bool BlocksdatFile::open_writer(const boost::filesystem::path& file_path, uint64
{
if (!boost::filesystem::is_directory(dir_path))
{
- LOG_PRINT_RED_L0("export directory path is a file: " << dir_path);
+ MFATAL("export directory path is a file: " << dir_path);
return false;
}
}
@@ -58,7 +60,7 @@ bool BlocksdatFile::open_writer(const boost::filesystem::path& file_path, uint64
{
if (!boost::filesystem::create_directory(dir_path))
{
- LOG_PRINT_RED_L0("Failed to create directory " << dir_path);
+ MFATAL("Failed to create directory " << dir_path);
return false;
}
}
@@ -66,7 +68,7 @@ bool BlocksdatFile::open_writer(const boost::filesystem::path& file_path, uint64
m_raw_data_file = new std::ofstream();
- LOG_PRINT_L0("creating file");
+ MINFO("creating file");
m_raw_data_file->open(file_path.string(), std::ios_base::binary | std::ios_base::out | std::ios::trunc);
if (m_raw_data_file->fail())
@@ -123,21 +125,21 @@ bool BlocksdatFile::store_blockchain_raw(Blockchain* _blockchain_storage, tx_mem
uint64_t block_start = 0;
uint64_t block_stop = 0;
- LOG_PRINT_L0("source blockchain height: " << m_blockchain_storage->get_current_blockchain_height()-1);
+ MINFO("source blockchain height: " << m_blockchain_storage->get_current_blockchain_height()-1);
if ((requested_block_stop > 0) && (requested_block_stop < m_blockchain_storage->get_current_blockchain_height()))
{
- LOG_PRINT_L0("Using requested block height: " << requested_block_stop);
+ MINFO("Using requested block height: " << requested_block_stop);
block_stop = requested_block_stop;
}
else
{
block_stop = m_blockchain_storage->get_current_blockchain_height() - 1;
- LOG_PRINT_L0("Using block height of source blockchain: " << block_stop);
+ MINFO("Using block height of source blockchain: " << block_stop);
}
- LOG_PRINT_L0("Storing blocks raw data...");
+ MINFO("Storing blocks raw data...");
if (!BlocksdatFile::open_writer(output_file, block_stop))
{
- LOG_PRINT_RED_L0("failed to open raw file for write");
+ MFATAL("failed to open raw file for write");
return false;
}
for (m_cur_height = block_start; m_cur_height <= block_stop; ++m_cur_height)
@@ -157,7 +159,7 @@ bool BlocksdatFile::store_blockchain_raw(Blockchain* _blockchain_storage, tx_mem
std::cout << refresh_string;
std::cout << "block " << m_cur_height-1 << "/" << block_stop << ENDL;
- LOG_PRINT_L0("Number of blocks exported: " << num_blocks_written);
+ MINFO("Number of blocks exported: " << num_blocks_written);
return BlocksdatFile::close();
}