summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs/src')
-rw-r--r--libglusterfs/src/Makefile.am2
-rw-r--r--libglusterfs/src/logging.c64
2 files changed, 10 insertions, 56 deletions
diff --git a/libglusterfs/src/Makefile.am b/libglusterfs/src/Makefile.am
index 569d69be330..ccac1a1e825 100644
--- a/libglusterfs/src/Makefile.am
+++ b/libglusterfs/src/Makefile.am
@@ -29,7 +29,7 @@ libglusterfs_la_SOURCES = dict.c xlator.c logging.c \
$(CONTRIBDIR)/stdlib/gf_mkostemp.c strfd.c \
$(CONTRIBDIR)/mount/mntent.c
-nodist_libglusterfs_la_SOURCES = y.tab.c graph.lex.c gf-error-codes.h
+nodist_libglusterfs_la_SOURCES = y.tab.c graph.lex.c
BUILT_SOURCES = graph.lex.c
diff --git a/libglusterfs/src/logging.c b/libglusterfs/src/logging.c
index 2a8335eb052..505580d1e81 100644
--- a/libglusterfs/src/logging.c
+++ b/libglusterfs/src/logging.c
@@ -23,16 +23,11 @@
#include <stdlib.h>
#include <syslog.h>
-#ifdef HAVE_LIBINTL_H
-#include <libintl.h>
-#endif
-
#ifdef HAVE_BACKTRACE
#include <execinfo.h>
#endif
#include <sys/stat.h>
-#include "gf-error-codes.h"
#define GF_JSON_MSG_LENGTH 8192
#define GF_SYSLOG_CEE_FORMAT \
@@ -477,18 +472,6 @@ gf_log_fini (void *data)
return ret;
}
-/**
- * gf_get_error_message -function to get error message for given error code
- * @error_code: error code defined by log book
- *
- * @return: success: string
- * failure: NULL
- */
-const char *
-gf_get_error_message (int error_code) {
- return _gf_get_message (error_code);
-}
-
/**
* gf_openlog -function to open syslog specific to gluster based on
@@ -516,10 +499,6 @@ gf_openlog (const char *ident, int option, int facility)
/* TODO: Should check for errors here and return appropriately */
setlocale(LC_ALL, "");
-#ifdef HAVE_LIBINTL_H
- bindtextdomain("gluster", "/usr/share/locale");
- textdomain("gluster");
-#endif
/* close the previous syslog if open as we are changing settings */
closelog ();
openlog(ident, _option, _facility);
@@ -633,50 +612,28 @@ _json_escape(const char *str, char *buf, size_t len)
/**
* gf_syslog -function to submit message to syslog specific to gluster
- * @error_code: error code defined by log book
* @facility_priority: facility_priority of syslog()
* @format: optional format string to syslog()
*
* @return: void
*/
void
-gf_syslog (int error_code, int facility_priority, char *format, ...)
+gf_syslog (int facility_priority, char *format, ...)
{
char *msg = NULL;
char json_msg[GF_JSON_MSG_LENGTH];
GF_UNUSED char *p = NULL;
- const char *error_message = NULL;
- char json_error_message[GF_JSON_MSG_LENGTH];
va_list ap;
- error_message = gf_get_error_message (error_code);
+ GF_ASSERT (format);
va_start (ap, format);
- if (format) {
- vasprintf (&msg, format, ap);
+ if (vasprintf (&msg, format, ap) != -1) {
p = _json_escape (msg, json_msg, GF_JSON_MSG_LENGTH);
- if (error_message) {
- p = _json_escape (error_message, json_error_message,
- GF_JSON_MSG_LENGTH);
- syslog (facility_priority, GF_SYSLOG_CEE_FORMAT,
- json_msg, error_code, json_error_message);
- } else {
- /* ignore the error code because no error message for it
- and use normal syslog */
- syslog (facility_priority, "%s", msg);
- }
+ syslog (facility_priority, "%s", msg);
free (msg);
- } else {
- if (error_message) {
- /* no user message: treat error_message as msg */
- syslog (facility_priority, GF_SYSLOG_CEE_FORMAT,
- json_error_message, error_code,
- json_error_message);
- } else {
- /* cannot produce log as neither error_message nor
- msg available */
- }
- }
+ } else
+ syslog (GF_LOG_CRITICAL, "vasprintf() failed, out of memory?");
va_end (ap);
}
@@ -898,8 +855,7 @@ _gf_log_callingfn (const char *domain, const char *file, const char *function,
vasprintf (&str2, fmt, ap);
va_end (ap);
- gf_syslog (GF_ERR_DEV, priority,
- "[%s:%d:%s] %s %d-%s: %s",
+ gf_syslog (priority, "[%s:%d:%s] %s %d-%s: %s",
basename, line, function,
callstr,
((this->graph) ? this->graph->id:0), domain,
@@ -1376,8 +1332,7 @@ gf_log_syslog (glusterfs_ctx_t *ctx, const char *domain, const char *file,
break;
case gf_logformat_cee:
/* TODO: Enhance CEE with additional parameters */
- gf_syslog (GF_ERR_DEV, priority,
- "[%s:%d:%s] %d-%s: %s",
+ gf_syslog (priority, "[%s:%d:%s] %d-%s: %s",
file, line, function, graph_id, domain, *appmsgstr);
break;
@@ -2180,8 +2135,7 @@ _gf_log (const char *domain, const char *file, const char *function, int line,
vasprintf (&str2, fmt, ap);
va_end (ap);
- gf_syslog (GF_ERR_DEV, priority,
- "[%s:%d:%s] %d-%s: %s",
+ gf_syslog (priority, "[%s:%d:%s] %d-%s: %s",
basename, line, function,
((this->graph) ? this->graph->id:0), domain, str2);
goto err;