From 1e4cc18362df17f87001ec42605b51daf251e0db Mon Sep 17 00:00:00 2001 From: Mohamed Ashiq Date: Tue, 19 May 2015 15:40:30 +0530 Subject: defaults,globals,iobuf,latency,logging,options,xlator/libglusterfs : porting to a new logging framework Backport of http://review.gluster.org/10826 Cherry picked from ef374774b8727b2f76915a1f88b26c83c77dde43 >Change-Id: If6a55186cddc3d1c4d22e3d56b45358b84feeb49 >BUG: 1194640 >Signed-off-by: Mohamed Ashiq >Reviewed-on: http://review.gluster.org/10826 >Tested-by: NetBSD Build System >Reviewed-by: Pranith Kumar Karampuri Change-Id: If6a55186cddc3d1c4d22e3d56b45358b84feeb49 BUG: 1217722 Signed-off-by: Mohamed Ashiq Reviewed-on: http://review.gluster.org/11405 Tested-by: Gluster Build System Tested-by: NetBSD Build System Reviewed-by: Niels de Vos --- libglusterfs/src/options.h | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'libglusterfs/src/options.h') diff --git a/libglusterfs/src/options.h b/libglusterfs/src/options.h index 05a3d4332cf..fa798db05ed 100644 --- a/libglusterfs/src/options.h +++ b/libglusterfs/src/options.h @@ -21,6 +21,7 @@ #include #include "xlator.h" +#include "libglusterfs-messages.h" /* Add possible new type of option you may need */ typedef enum { GF_OPTION_TYPE_ANY = 0, @@ -133,7 +134,8 @@ xlator_option_init_##type (xlator_t *this, dict_t *options, char *key, \ \ opt = xlator_volume_option_get (this, key); \ if (!opt) { \ - gf_log (this->name, GF_LOG_WARNING, \ + gf_msg (this->name, GF_LOG_WARNING, EINVAL, \ + LG_MSG_INVALID_ENTRY, \ "unknown option: %s", key); \ ret = -1; \ return ret; \ @@ -146,27 +148,26 @@ xlator_option_init_##type (xlator_t *this, dict_t *options, char *key, \ if (set_value) \ value = set_value; \ if (!value) { \ - gf_log (this->name, GF_LOG_TRACE, "option %s not set", \ + gf_msg_trace (this->name, 0, "option %s not set", \ key); \ *val_p = (type_t)0; \ return 0; \ } \ if (value == def_value) { \ - gf_log (this->name, GF_LOG_TRACE, \ - "option %s using default value %s", \ - key, value); \ + gf_msg_trace (this->name, 0, "option %s using default" \ + " value %s", key, value); \ } else { \ - gf_log (this->name, GF_LOG_DEBUG, \ - "option %s using set value %s", \ - key, value); \ + gf_msg_debug (this->name, 0, "option %s using set" \ + " value %s", key, value); \ } \ old_THIS = THIS; \ THIS = this; \ ret = conv (value, val_p); \ THIS = old_THIS; \ if (ret) { \ - gf_log (this->name, GF_LOG_INFO, \ - "option %s convertion failed value %s", \ + gf_msg (this->name, GF_LOG_INFO, 0, \ + LG_MSG_CONVERSION_FAILED, \ + "option %s conversion failed value %s", \ key, value); \ return ret; \ } \ @@ -219,7 +220,8 @@ xlator_option_reconf_##type (xlator_t *this, dict_t *options, char *key, \ \ opt = xlator_volume_option_get (this, key); \ if (!opt) { \ - gf_log (this->name, GF_LOG_WARNING, \ + gf_msg (this->name, GF_LOG_WARNING, EINVAL, \ + LG_MSG_INVALID_ENTRY, \ "unknown option: %s", key); \ ret = -1; \ return ret; \ @@ -232,17 +234,16 @@ xlator_option_reconf_##type (xlator_t *this, dict_t *options, char *key, \ if (set_value) \ value = set_value; \ if (!value) { \ - gf_log (this->name, GF_LOG_TRACE, "option %s not set", \ - key); \ + gf_msg_trace (this->name, 0, "option %s not set", key); \ *val_p = (type_t)0; \ return 0; \ } \ if (value == def_value) { \ - gf_log (this->name, GF_LOG_TRACE, \ + gf_msg_trace (this->name, 0, \ "option %s using default value %s", \ key, value); \ } else { \ - gf_log (this->name, GF_LOG_DEBUG, \ + gf_msg_debug (this->name, 0, \ "option %s using set value %s", \ key, value); \ } \ -- cgit