Clean up of log handling.
This commit is contained in:
parent
60c29f37d3
commit
20a33d1ff0
3 changed files with 15 additions and 9 deletions
|
@ -180,6 +180,7 @@ int CYSFGateway::run()
|
|||
ret = rptNetwork.open();
|
||||
if (!ret) {
|
||||
::LogError("Cannot open the repeater network port");
|
||||
::LogFinalise();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -189,6 +190,7 @@ int CYSFGateway::run()
|
|||
ret = m_netNetwork->open();
|
||||
if (!ret) {
|
||||
::LogError("Cannot open the reflector network port");
|
||||
::LogFinalise();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -57,12 +57,10 @@ int main(int argc, char** argv)
|
|||
if ((arg == "-v") || (arg == "--version")) {
|
||||
::fprintf(stdout, "YSFReflector version %s\n", VERSION);
|
||||
return 0;
|
||||
}
|
||||
else if (arg.substr(0, 1) == "-") {
|
||||
} else if (arg.substr(0, 1) == "-") {
|
||||
::fprintf(stderr, "Usage: YSFReflector [-v|--version] [filename]\n");
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
iniFile = argv[currentArg];
|
||||
}
|
||||
}
|
||||
|
@ -161,8 +159,10 @@ void CYSFReflector::run()
|
|||
CNetwork network(m_conf.getNetworkPort(), m_conf.getName(), m_conf.getDescription(), m_conf.getNetworkDebug());
|
||||
|
||||
ret = network.open();
|
||||
if (!ret)
|
||||
if (!ret) {
|
||||
::LogFinalise();
|
||||
return;
|
||||
}
|
||||
|
||||
network.setCount(0);
|
||||
|
||||
|
|
Loading…
Reference in a new issue