Commit 73c92939 authored by John Hodge's avatar John Hodge
Browse files

Server - Fix inverted logic in enabling/disabling syslog

parent 0a03be34
......@@ -73,6 +73,8 @@ extern int giNumHandlers;
extern int giDebugLevel;
extern bool gbNoCostMode;
extern bool gbSyslogDisabled;
// === FUNCTIONS ===
extern void Items_UpdateFile(void);
......
......@@ -11,24 +11,24 @@
#include <syslog.h>
// === GLOBALS ===
bool gbSyslogEnabled = true;
bool gbSyslogDisabled = true;
// === CODE ==
void Log_Error(const char *Format, ...)
{
va_list args;
va_start(args, Format);
if( gbSyslogEnabled )
if( !gbSyslogDisabled )
{
va_start(args, Format);
vsyslog(LOG_WARNING, Format, args);
va_end(args);
}
else
{
fprintf(stderr, "WARNING: ");
vfprintf(stderr, Format, args);
fprintf(stderr, "\n");
}
va_start(args, Format);
fprintf(stderr, "WARNING: ");
vfprintf(stderr, Format, args);
fprintf(stderr, "\n");
va_end(args);
}
......@@ -36,17 +36,16 @@ void Log_Info(const char *Format, ...)
{
va_list args;
va_start(args, Format);
if( gbSyslogEnabled )
if( !gbSyslogDisabled )
{
va_start(args, Format);
vsyslog(LOG_INFO, Format, args);
va_end(args);
}
else
{
fprintf(stderr, "WARNING: ");
vfprintf(stderr, Format, args);
fprintf(stderr, "\n");
}
va_start(args, Format);
fprintf(stderr, "INFO: ");
vfprintf(stderr, Format, args);
fprintf(stderr, "\n");
va_end(args);
}
......@@ -33,7 +33,6 @@ extern const char *gsItemListFile;
extern const char *gsCoke_ModbusAddress;
extern int giCoke_ModbusPort;
extern const char *gsDoor_SerialPort;
extern bool gbSyslogEnabled;
// === PROTOTYPES ===
void *Periodic_Thread(void *Unused);
......@@ -144,7 +143,7 @@ int main(int argc, char *argv[])
OPT_CFG(giCoke_ModbusPort, Int, "coke_modbus_port");
OPT_CFG(gbNoCostMode, Bool, "test_mode");
OPT_CFG(gbSyslogEnabled, Bool, "disable_syslog");
OPT_CFG(gbSyslogDisabled, Bool, "disable_syslog");
if( !rv ) {
fprintf(stderr, "ERROR: Some required configuration items were missing\n");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment