Clean up of log handling.

This commit is contained in:
Jonathan Naylor 2016-10-04 17:39:17 +01:00
parent 60c29f37d3
commit 20a33d1ff0
3 changed files with 15 additions and 9 deletions

View file

@ -31,14 +31,14 @@
int main(int argc, char** argv)
{
if (argc == 1) {
::fprintf(stderr, "Usage: YSFParrot [-d] <port>\n");
::fprintf(stderr, "Usage: YSFParrot [-d|--debug] <port>\n");
return 1;
}
unsigned int n = 1U;
bool debug = false;
if (::strcmp(argv[1], "-d") == 0) {
if (::strcmp(argv[1], "-d") == 0 || ::strcmp(argv[1], "--debug") == 0) {
debug = true;
n = 2U;
}
@ -67,12 +67,16 @@ CYSFParrot::~CYSFParrot()
void CYSFParrot::run()
{
::LogInitialise(".", "YSFParrot", m_debug ? 1U : 2U, m_debug ? 1U : 2U);
bool ret = ::LogInitialise(".", "YSFParrot", m_debug ? 1U : 2U, m_debug ? 1U : 2U);
if (!ret) {
::fprintf(stderr, "YSFParrot: unable to open the log file\n");
return;
}
CParrot parrot(180U);
CNetwork network(m_port);
bool ret = network.open();
ret = network.open();
if (!ret) {
::LogFinalise();
return;