diff options
| author | Amar Tumballi <amar@gluster.com> | 2010-08-12 01:54:38 +0000 | 
|---|---|---|
| committer | Anand V. Avati <avati@dev.gluster.com> | 2010-08-12 00:45:48 -0700 | 
| commit | 78615ceea81479b38af43697766bcc04421a256d (patch) | |
| tree | f5c95b96121abcd4fa0a8f6ce2f6c5e9d2df8366 /libglusterfs/src/logging.h | |
| parent | 553aa029de1817ae182cc86c1d00f8eb8ff52b50 (diff) | |
logging enhancements
* per translator loglevel introduced, if set, it will override process
  wide log level.
* with extended attribute 'trusted.glusterfs.<xlator-name>.set-log-level'
  with the value being '<LOGLEVEL>', one can change log level of particular
  translator.
* with extended attribute 'trusted.glusterfs.syslog' with the value
  '<BOOLEAN>', one can enable disable syslog for gluster
Signed-off-by: Amar Tumballi <amar@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 601 (Enable changing 'log-level' of GlusterFS process at runtime)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=601
Diffstat (limited to 'libglusterfs/src/logging.h')
| -rw-r--r-- | libglusterfs/src/logging.h | 38 | 
1 files changed, 27 insertions, 11 deletions
diff --git a/libglusterfs/src/logging.h b/libglusterfs/src/logging.h index fdb24dab9f6..f727bfe421d 100644 --- a/libglusterfs/src/logging.h +++ b/libglusterfs/src/logging.h @@ -1,5 +1,5 @@  /* -   Copyright (c) 2006-2009 Gluster, Inc. <http://www.gluster.com> +   Copyright (c) 2006-2010 Gluster, Inc. <http://www.gluster.com>     This file is part of GlusterFS.     GlusterFS is free software; you can redistribute it and/or modify @@ -44,13 +44,28 @@  #define GF_PRI_BLKSIZE     PRId32  #define GF_PRI_SIZET       "zu" +#if 0 +/* Syslog definitions :-) */ +#define LOG_EMERG   0           /* system is unusable */ +#define LOG_ALERT   1           /* action must be taken immediately */ +#define LOG_CRIT    2           /* critical conditions */ +#define LOG_ERR     3           /* error conditions */ +#define LOG_WARNING 4           /* warning conditions */ +#define LOG_NOTICE  5           /* normal but significant condition */ +#define LOG_INFO    6           /* informational */ +#define LOG_DEBUG   7           /* debug-level messages */ +#endif +  typedef enum {  	GF_LOG_NONE, +        GF_LOG_EMERG, +        GF_LOG_ALERT,  	GF_LOG_CRITICAL,   /* fatal errors */  	GF_LOG_ERROR,      /* major failures (not necessarily fatal) */  	GF_LOG_WARNING,    /* info about normal operation */ +        GF_LOG_NOTICE,  	GF_LOG_INFO,       /* Normal information */ -#define GF_LOG_NORMAL GF_LOG_INFO +#define GF_LOG_NORMAL      GF_LOG_INFO  	GF_LOG_DEBUG,      /* internal errors */          GF_LOG_TRACE,      /* full trace of operation */  } gf_loglevel_t; @@ -60,9 +75,8 @@ typedef enum {  extern gf_loglevel_t gf_log_loglevel;  #define gf_log(dom, levl, fmt...) do {					\ -		if (levl <= gf_log_loglevel)				\ -			_gf_log (dom, __FILE__, __FUNCTION__, __LINE__, \ -				 levl, ##fmt);				\ +                _gf_log (dom, __FILE__, __FUNCTION__, __LINE__,         \ +                         levl, ##fmt);                                  \  		if (0) {						\  			printf (fmt);					\  		}							\ @@ -73,8 +87,8 @@ extern gf_loglevel_t gf_log_loglevel;                  gf_log (args);                                                \          } -			 -void  + +void  gf_log_logrotate (int signum);  int gf_log_init (const char *filename); @@ -90,10 +104,12 @@ gf_log_from_client (const char *msg, char *identifier);  void gf_log_lock (void);  void gf_log_unlock (void); -gf_loglevel_t  -gf_log_get_loglevel (void); -void  -gf_log_set_loglevel (gf_loglevel_t level); +void gf_log_disable_syslog (void); +void gf_log_enable_syslog (void); +gf_loglevel_t gf_log_get_loglevel (void); +void gf_log_set_loglevel (gf_loglevel_t level); +gf_loglevel_t gf_log_get_xl_loglevel (void *xl); +void gf_log_set_xl_loglevel (void *xl, gf_loglevel_t level);  #define GF_DEBUG(xl, format, args...) \  	gf_log ((xl)->name, GF_LOG_DEBUG, format, ##args)  | 
