#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);
}
{
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);
}
extern const char *gsCoke_ModbusAddress;
extern int giCoke_ModbusPort;
extern const char *gsDoor_SerialPort;
-extern bool gbSyslogEnabled;
// === PROTOTYPES ===
void *Periodic_Thread(void *Unused);
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");