mirror of
https://github.com/EvernodeXRPL/hpcore.git
synced 2026-04-29 15:37:59 +00:00
Added file log.
This commit is contained in:
23
src/main.cpp
23
src/main.cpp
@@ -62,6 +62,22 @@ int parse_cmd(int argc, char **argv)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs any cleanup on graceful application termination.
|
||||
*/
|
||||
void deinit()
|
||||
{
|
||||
usr::deinit();
|
||||
hplog::deinit();
|
||||
}
|
||||
|
||||
void signal_handler(int signum)
|
||||
{
|
||||
LOG_WARN << "Interrupt signal (" << signum << ") received.";
|
||||
deinit();
|
||||
exit(signum);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
// Extract the CLI args
|
||||
@@ -101,7 +117,7 @@ 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)
|
||||
return -1;
|
||||
|
||||
@@ -110,6 +126,9 @@ int main(int argc, char **argv)
|
||||
if (usr::init() != 0)
|
||||
return -1;
|
||||
|
||||
// After initializing primary subsystems, register the SIGINT handler.
|
||||
signal(SIGINT, signal_handler);
|
||||
|
||||
// This will start hosting the contract and start consensus rounds.
|
||||
// TODO
|
||||
|
||||
@@ -156,7 +175,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
// Free resources.
|
||||
usr::deinit();
|
||||
deinit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user