Commit fe1ffccf authored by Sebastien Ponce's avatar Sebastien Ponce
Browse files

Imrpoved logging in Cns_proc by disentangling loglevel and return code

parent 4b21dfb3
......@@ -28,25 +28,6 @@
#define LOG_INFO 6 /* informational */
#define LOG_DEBUG 7 /* debug-level messages */
#define RETURN(x) \
{ \
if (thip->dbfd.tr_started) { \
if (x) { \
(void) Cns_abort_tr (&thip->dbfd); \
} else if (! thip->dbfd.tr_mode) { \
(void) Cns_end_tr (&thip->dbfd); \
} \
} \
nslogreq(reqinfo, func, x); \
return ((x)); \
}
#define RETURNQ(x) \
{ \
nslogreq(reqinfo, func, x); \
return ((x)); \
}
/* name server tables and structures */
struct Cns_dbfd {
......@@ -159,7 +140,6 @@ EXTERN_C int sendrep (int, int, ...);
EXTERN_C int openlog (const char *, const char *);
EXTERN_C int closelog (void);
EXTERN_C int nslogit (const int, const char *, ...);
EXTERN_C int nslogreq (struct Cns_srv_request_info *, const char *, const int);
EXTERN_C int Cns_abort_tr (struct Cns_dbfd *);
EXTERN_C int Cns_acl_chmod (struct Cns_file_metadata *);
......
This diff is collapsed.
......@@ -216,7 +216,8 @@ int _write_to_log(char *buffer, int buflen) {
int nslogreq(struct Cns_srv_request_info *reqinfo,
const char *func,
const int errorcode) {
const int errorcode,
const int loglevel) {
/* Variables */
struct timeval tv;
......@@ -229,7 +230,7 @@ int nslogreq(struct Cns_srv_request_info *reqinfo,
return 0;
/* Retrieve the header part of the message. */
len = _format_header(buffer, sizeof(buffer), errorcode?LOG_ERR:LOG_INFO);
len = _format_header(buffer, sizeof(buffer), loglevel);
/* Here we format the message parameters in accordance with the DLF
* specifications. First we handle the REQID, NSFILID and NSHOSTNAME. Note:
......@@ -272,7 +273,7 @@ int nslogreq(struct Cns_srv_request_info *reqinfo,
errorcode, sstrerror(errorcode), elapsed);
} else {
len += snprintf(buffer + len, sizeof(buffer) - len,
"RtnCode=%d ProcessingTime=%.3f ", errorcode, elapsed);
"RtnCode=0 ProcessingTime=%.3f ", elapsed);
}
/* Write the message to the log file. */
......
Supports Markdown
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