From b457fec36399c1f7de093d5e92bb4fa453b79c86 Mon Sep 17 00:00:00 2001 From: Jakub Sławiński Date: Sun, 5 Feb 2006 15:14:03 +0100 Subject: v0.8 - Fixed: infinite loop after buffering message - Fixed: corrupt packets after closing connections in the stopped state - Fixed: bug in mapping user numbers between afclient and afserver - Fixed: premature close of the service connection - Fixed: invalid buffering when the connection is closing - Added: Multiple tunnels in one afclient<->afserver connection --- src/logging.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 81 insertions(+), 1 deletion(-) (limited to 'src/logging.c') diff --git a/src/logging.c b/src/logging.c index cfe77e4..fd38431 100644 --- a/src/logging.c +++ b/src/logging.c @@ -31,6 +31,12 @@ static llnodeT* head = NULL; static char verlev; static char format[51] = "%Y-%m-%d %H:%M:%S"; +/* + * Function name: setdateformat + * Description: Sets the new date format based on the given string. + * Arguments: dateformat - the new date format + */ + void setdateformat(char* dateformat) { @@ -39,12 +45,25 @@ setdateformat(char* dateformat) } } +/* + * Function name: getdateformat + * Description: Returns the date format. + * Returns: The date format. + */ + char* getdateformat() { return format; } +/* + * Function name: localdate + * Description: Returns the formatted date string. + * Arguments: sec - the date in seconds + * Returns: The formatted date. + */ + char* localdate(time_t* sec) { @@ -54,7 +73,13 @@ localdate(time_t* sec) memset(localdat, 0, 31); strftime(localdat, 30, format, tm); return localdat; -} +} + +/* + * Function name: datum + * Description: Returns the formatted date string. + * Returns: The formatted date. + */ char* datum(void) @@ -69,12 +94,27 @@ datum(void) return timedat; } +/* + * Function name: getloglisthead + * Description: Returns the head of the log targets list. + * Returns: The head of the log targets list. + */ + llnodeT* getloglisthead() { return head; } +/* + * Function name: checkmsgti + * Description: Adds the given msgtype/importance to the log target. + * Arguments: target - the log target + * tab - the name of the msttype/importance + * Returns: 0 - success, + * 1 - failure. + */ + int checkmsgti(llnodeT* target, char* tab) { @@ -123,6 +163,14 @@ checkmsgti(llnodeT* target, char* tab) return 0; } +/* + * Function name: checklogtarget + * Description: Parses the command line and sets all the options. + * Arguments: target - the log target + * Returns 0 - success, + * !0 - failure. + */ + int checklogtarget(llnodeT* target) { @@ -258,6 +306,12 @@ checklogtarget(llnodeT* target) return 0; } +/* + * Function name: addlogtarget + * Description: Adds the new non-initialized log target with the specified command line. + * Arguments: cmdline - the command line + */ + void addlogtarget(char* cmdline) { @@ -267,6 +321,15 @@ addlogtarget(char* cmdline) head = newnode; } +/* + * Function name: loginit + * Description: Initializes the logging system. + * Arguments: verl - level of verbosity + * dateformat - date format + * Returns: 0 - success, + * !0 - failure. + */ + int loginit(char verl, char* dateformat) { @@ -316,6 +379,14 @@ loginit(char verl, char* dateformat) return 0; } +/* + * Function name: initializelogging + * Description: The opaque function for loginit. If the logging initialization + * failed, it prints the appropriate message and exits. + * Arguments: verl - level of verbosity + * dateformat - date format + */ + void initializelogging(char verl, char* dateformat) { @@ -357,6 +428,15 @@ initializelogging(char verl, char* dateformat) } } +/* + * Function name: aflog + * Description: Logs the given message. + * Arguments: type - the type of the message + * importance - the importance of the message + * form - the format of the message + * ... - the additional arguments + */ + void aflog(char type, char importance, const char* form, ...) { -- cgit v1.1