From: John Hodge Date: Fri, 7 Jan 2011 03:57:27 +0000 (+0800) Subject: Moved to syslog for the dispense log X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=f75c35bdf5e2c6c1104c22c32bd0d55ca16b52c9;p=tpg%2Fopendispense2.git Moved to syslog for the dispense log - Commenting changes --- diff --git a/src/server/dispense.c b/src/server/dispense.c index 77f07ac..af40c37 100644 --- a/src/server/dispense.c +++ b/src/server/dispense.c @@ -47,7 +47,7 @@ int DispenseItem(int User, tItem *Item) } // 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) ); @@ -74,6 +74,9 @@ int DispenseGive(int SrcUser, int DestUser, int Ammount, const char *ReasonGiven return 0; } +/** + * \brief Add money to an account + */ int DispenseAdd(int User, int ByUser, int Ammount, const char *ReasonGiven) { int ret; diff --git a/src/server/logging.c b/src/server/logging.c index ac1e603..d7313c9 100644 --- a/src/server/logging.c +++ b/src/server/logging.c @@ -7,6 +7,7 @@ #include #include #include "common.h" +#include // === CODE == void Log_Error(const char *Format, ...) @@ -14,9 +15,7 @@ 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); } @@ -25,9 +24,7 @@ void Log_Info(const char *Format, ...) va_list args; va_start(args, Format); - printf("Info : "); - vprintf(Format, args); - printf("\n"); + vsyslog(LOG_INFO, Format, args); va_end(args); } diff --git a/src/server/main.c b/src/server/main.c index 8abb984..b23cee4 100644 --- a/src/server/main.c +++ b/src/server/main.c @@ -17,6 +17,7 @@ #include #include #include +#include // === IMPORTS === extern void Init_Cokebank(const char *Argument); // cokebank.c @@ -82,6 +83,8 @@ int main(int argc, char *argv[]) signal(SIGINT, sigint_handler); + openlog("odispense2", 0, LOG_LOCAL4); + Init_Cokebank(gsCokebankPath); Init_Handlers(); diff --git a/src/server/server.c b/src/server/server.c index 930298a..2a10bab 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -812,7 +812,7 @@ void Server_Cmd_USERFLAGS(tClient *Client, char *Args) {"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