From 83447a051fbcc88b33fcea6670520687668d3ba1 Mon Sep 17 00:00:00 2001 From: Chris Hall Date: Thu, 8 Apr 2010 19:51:10 +0100 Subject: New functions for error numbers and addresses in messages. Implemented less onerous ways of including descriptions of errors and IP addresses in logging and other messages. Implemented mapping of error numbers to error names, which is generally more meaningful. --- lib/log.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'lib/log.c') diff --git a/lib/log.c b/lib/log.c index 3e5c80ad..32b11b76 100644 --- a/lib/log.c +++ b/lib/log.c @@ -289,7 +289,7 @@ uvzlog_line(struct logline* ll, struct zlog *zl, int priority, va_end(vac); /* Set pointer to where the '\0' is. */ - p = ll->p_nl = qfs_end(&qfs) ; + p = ll->p_nl = qfs_ptr(&qfs) ; } ; /* finish off with '\r''\n''\0' or '\n''\0' as required */ @@ -753,9 +753,9 @@ _zlog_abort_err (const char *mess, int err, const char *file, const static size_t buff_size = 1024; char buff[buff_size]; snprintf(buff, buff_size, - "%s, in file %s, line %u, function %s, error %d \"%s\"", + "%s, in file %s, line %u, function %s, %s", mess, file, line, (function ? function : "?"), - err, safe_strerror(err)); + errtoa(err, 0).str); zlog_abort(buff); } @@ -939,8 +939,9 @@ zlog_rotate (struct zlog *zl) { /* can't call logging while locked */ char *fname = strdup(zl->filename); - uzlog(NULL, LOG_ERR, "Log rotate failed: cannot open file %s for append: %s", - fname, safe_strerror(save_errno)); + uzlog(NULL, LOG_ERR, + "Log rotate failed: cannot open file %s for append: %s", + fname, errtoa(save_errno, 0).str); free(fname); result = -1; } -- cgit v1.2.3