diff options
author | Prasanna Kumar Kalever <prasanna.kalever@redhat.com> | 2017-06-04 12:27:27 +0530 |
---|---|---|
committer | Prasanna Kumar Kalever <prasanna.kalever@redhat.com> | 2017-06-05 22:46:33 +0530 |
commit | b5337c894f66661fb6a863467bcfac3fa12eaa7c (patch) | |
tree | 2f501430a21f65fffa718413d8c159d1346f240a /utils/utils.c | |
parent | bc283e0e6924d83044f6cbb8e3ad5e35c29a8c3d (diff) |
logger: filter log messages based on severity level
This patch adds '--log-level' options
supported log levels:
{
"NONE",
"ERROR",
"WARNING",
"INFO",
"DEBUG",
"TRACE"
}
TRACE being max logging
$ gluster-blockd --help
[...]
--log-level <LOGLEVEL>
Logging severity. Valid options are,
TRACE, DEBUG, INFO, WARNING, ERROR and NONE [default: INFO]
[...]
Change-Id: I5a387eea3e7e7be10a0b56102a61eb81b4ebf2fa
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
Diffstat (limited to 'utils/utils.c')
-rw-r--r-- | utils/utils.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/utils/utils.c b/utils/utils.c index 49a5d3d..ec85882 100644 --- a/utils/utils.c +++ b/utils/utils.c @@ -13,6 +13,8 @@ # include "config.h" +size_t logLevel = GB_LOG_INFO; + const char *argp_program_version = "" \ PACKAGE_NAME" ("PACKAGE_VERSION")" \ "\nRepository rev: https://github.com/gluster/gluster-block.git\n" \ @@ -69,6 +71,26 @@ glusterBlockDaemonOptEnumParse(const char *opt) int +blockLogLevelEnumParse(const char *opt) +{ + int i; + + + if (!opt) { + return GB_LOG_MAX; + } + + for (i = 0; i < GB_LOG_MAX; i++) { + if (!strcmp(opt, LogLevelLookup[i])) { + return i; + } + } + + return i; +} + + +int blockMetaKeyEnumParse(const char *opt) { int i; |