1
0
Fork 0

Clean up of log handling.

ycs232-kbc
Jonathan Naylor 8 years ago
parent 60c29f37d3
commit 20a33d1ff0

@ -180,6 +180,7 @@ int CYSFGateway::run()
ret = rptNetwork.open(); ret = rptNetwork.open();
if (!ret) { if (!ret) {
::LogError("Cannot open the repeater network port"); ::LogError("Cannot open the repeater network port");
::LogFinalise();
return 1; return 1;
} }
@ -189,6 +190,7 @@ int CYSFGateway::run()
ret = m_netNetwork->open(); ret = m_netNetwork->open();
if (!ret) { if (!ret) {
::LogError("Cannot open the reflector network port"); ::LogError("Cannot open the reflector network port");
::LogFinalise();
return 1; return 1;
} }

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

@ -57,12 +57,10 @@ int main(int argc, char** argv)
if ((arg == "-v") || (arg == "--version")) { if ((arg == "-v") || (arg == "--version")) {
::fprintf(stdout, "YSFReflector version %s\n", VERSION); ::fprintf(stdout, "YSFReflector version %s\n", VERSION);
return 0; return 0;
} } else if (arg.substr(0, 1) == "-") {
else if (arg.substr(0, 1) == "-") {
::fprintf(stderr, "Usage: YSFReflector [-v|--version] [filename]\n"); ::fprintf(stderr, "Usage: YSFReflector [-v|--version] [filename]\n");
return 1; return 1;
} } else {
else {
iniFile = argv[currentArg]; iniFile = argv[currentArg];
} }
} }
@ -161,8 +159,10 @@ void CYSFReflector::run()
CNetwork network(m_conf.getNetworkPort(), m_conf.getName(), m_conf.getDescription(), m_conf.getNetworkDebug()); CNetwork network(m_conf.getNetworkPort(), m_conf.getName(), m_conf.getDescription(), m_conf.getNetworkDebug());
ret = network.open(); ret = network.open();
if (!ret) if (!ret) {
::LogFinalise();
return; return;
}
network.setCount(0); network.setCount(0);

Loading…
Cancel
Save