}
// And log that it happened
- Log_Info("dispense %s (%s:%i) by %s [cost %i, balance %i cents]",
+ Log_Info("dispense '%s' (%s:%i) by %s [cost %i, balance %i cents]",
Item->Name, handler->Name, Item->ID,
username, Item->Price, GetBalance(User)
);
return 0;
}
+/**
+ * \brief Add money to an account
+ */
int DispenseAdd(int User, int ByUser, int Ammount, const char *ReasonGiven)
{
int ret;
#include <stdio.h>
#include <stdarg.h>
#include "common.h"
+#include <syslog.h>
// === CODE ==
void Log_Error(const char *Format, ...)
va_list args;
va_start(args, Format);
- fprintf(stderr, "Error: ");
- vfprintf(stderr, Format, args);
- fprintf(stderr, "\n");
+ vsyslog(LOG_WARNING, Format, args);
va_end(args);
}
va_list args;
va_start(args, Format);
- printf("Info : ");
- vprintf(Format, args);
- printf("\n");
+ vsyslog(LOG_INFO, Format, args);
va_end(args);
}
#include <sys/stat.h>
#include <fcntl.h>
#include <stdarg.h>
+#include <syslog.h>
// === IMPORTS ===
extern void Init_Cokebank(const char *Argument); // cokebank.c
signal(SIGINT, sigint_handler);
+ openlog("odispense2", 0, LOG_LOCAL4);
+
Init_Cokebank(gsCokebankPath);
Init_Handlers();
{"coke", USER_FLAG_TYPEMASK, USER_TYPE_COKE},
{"wheel", USER_FLAG_TYPEMASK, USER_TYPE_WHEEL},
{"meta", USER_FLAG_TYPEMASK, USER_TYPE_GOD}
- };
+ };
const int ciNumFlags = sizeof(cFLAGS)/sizeof(cFLAGS[0]);
while( *flags == ' ' ) flags ++; // Eat whitespace