summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/logging.h
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs/src/logging.h')
-rw-r--r--libglusterfs/src/logging.h39
1 files changed, 23 insertions, 16 deletions
diff --git a/libglusterfs/src/logging.h b/libglusterfs/src/logging.h
index aa6e00edb70..0664b2efae0 100644
--- a/libglusterfs/src/logging.h
+++ b/libglusterfs/src/logging.h
@@ -69,8 +69,6 @@ typedef enum {
GF_LOG_TRACE, /* full trace of operation */
} gf_loglevel_t;
-#define GF_LOG_MAX GF_LOG_DEBUG
-
extern gf_loglevel_t gf_log_loglevel;
extern char gf_log_xl_log_set;
@@ -94,27 +92,38 @@ extern char gf_log_xl_log_set;
levl, ##fmt); \
} while (0)
+
+/* No malloc or calloc should be called in this function */
+#define gf_log_nomem(dom, levl, size) do { \
+ if ((levl > gf_log_loglevel) && !gf_log_xl_log_set) \
+ break; \
+ _gf_log_nomem (dom, __FILE__, __FUNCTION__, __LINE__, \
+ levl, size); \
+ } while (0)
+
+
/* Log once in GF_UNIVERSAL_ANSWER times */
#define GF_LOG_OCCASIONALLY(var, args...) if (!(var++%GF_UNIVERSAL_ANSWER)) { \
gf_log (args); \
}
-void
-gf_log_logrotate (int signum);
+void gf_log_logrotate (int signum);
+void gf_log_globals_init (void);
int gf_log_init (const char *filename);
void gf_log_cleanup (void);
-int
-_gf_log (const char *domain, const char *file, const char *function,
- int32_t line, gf_loglevel_t level, const char *fmt, ...);
-int
-_gf_log_callingfn (const char *domain, const char *file, const char *function,
- int32_t line, gf_loglevel_t level, const char *fmt, ...);
+int _gf_log (const char *domain, const char *file, const char *function,
+ int32_t line, gf_loglevel_t level, const char *fmt, ...);
+int _gf_log_callingfn (const char *domain, const char *file, const char *function,
+ int32_t line, gf_loglevel_t level, const char *fmt, ...);
+
+int _gf_log_nomem (const char *domain, const char *file,
+ const char *function, int line, gf_loglevel_t level,
+ size_t size);
-int
-gf_log_from_client (const char *msg, char *identifier);
+int gf_log_from_client (const char *msg, char *identifier);
void gf_log_lock (void);
void gf_log_unlock (void);
@@ -135,9 +144,7 @@ void gf_log_set_xl_loglevel (void *xl, gf_loglevel_t level);
#define GF_ERROR(xl, format, args...) \
gf_log ((xl)->name, GF_LOG_ERROR, format, ##args)
-int
-gf_cmd_log (const char *domain, const char *fmt, ...);
+int gf_cmd_log (const char *domain, const char *fmt, ...);
-int
-gf_cmd_log_init (const char *filename);
+int gf_cmd_log_init (const char *filename);
#endif /* __LOGGING_H__ */