Boost log integration. (#37)

This commit is contained in:
Ravin Perera
2019-10-20 21:45:59 +05:30
committed by GitHub
parent 84f43b7549
commit 2d5d8960c0
13 changed files with 266 additions and 61 deletions

View File

@@ -14,6 +14,7 @@
#include "crypto.hpp"
#include "usr/usr.hpp"
#include "proc.hpp"
#include "hplog.hpp"
/**
* Parses CLI args and extracts hot pocket command and parameters given.
@@ -64,7 +65,7 @@ int parse_cmd(int argc, char **argv)
int main(int argc, char **argv)
{
// Extract the CLI args
// After this call conf::ctx must be populated.
// This call will populate conf::ctx
if (parse_cmd(argc, argv) != 0)
return -1;
@@ -100,7 +101,13 @@ int main(int argc, char **argv)
else if (conf::ctx.command == "run")
{
// In order to host the contract we should init some required sub systems.
if (conf::init() != 0 || usr::init() != 0)
if (conf::init() != 0)
return -1;
hplog::init();
if (usr::init() != 0)
return -1;
// This will start hosting the contract and start consensus rounds.
@@ -143,7 +150,7 @@ int main(int argc, char **argv)
}
if (!hpscbufpair.second.empty())
std::cout << "Message from SC: " << hpscbufpair.second << std::endl;
LOG_DBG << "Message from SC: " << hpscbufpair.second;
userbufs.clear();
}
@@ -153,7 +160,8 @@ int main(int argc, char **argv)
}
}
}
std::cout << "exited normally\n";
LOG_INFO << "exited normally";
return 0;
}
@@ -162,6 +170,6 @@ int main(int argc, char **argv)
*/
void boost::throw_exception(std::exception const &e)
{
std::cerr << "Boost error:" << e.what() << std::endl;
LOG_ERR << "Boost error:" << e.what();
exit(-1);
}