From: Joao Eduardo Luis Date: Mon, 28 Jul 2014 22:04:17 +0000 (+0100) Subject: common: LogEntry: add clog_type_to_string() X-Git-Tag: v0.86~167^2~18 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3178ca9ebabf482ad3df574d04768ae21dbf3929;p=ceph.git common: LogEntry: add clog_type_to_string() Signed-off-by: Joao Eduardo Luis --- diff --git a/src/common/LogEntry.cc b/src/common/LogEntry.cc index a5fd96e2db59..235f0ed36d0c 100644 --- a/src/common/LogEntry.cc +++ b/src/common/LogEntry.cc @@ -130,6 +130,25 @@ int string_to_syslog_facility(string s) return LOG_USER; } +string clog_type_to_string(clog_type t) +{ + switch (t) { + case CLOG_DEBUG: + return "debug"; + case CLOG_INFO: + return "info"; + case CLOG_WARN: + return "warn"; + case CLOG_ERROR: + return "err"; + case CLOG_SEC: + return "crit"; + default: + assert(0); + return 0; + } +} + void LogEntry::log_to_syslog(string level, string facility) { int min = string_to_syslog_level(level); diff --git a/src/common/LogEntry.h b/src/common/LogEntry.h index 86a7fec88f78..e9a1968e3776 100644 --- a/src/common/LogEntry.h +++ b/src/common/LogEntry.h @@ -40,6 +40,7 @@ int clog_type_to_syslog_level(clog_type t); int string_to_syslog_level(string s); int string_to_syslog_facility(string s); +string clog_type_to_string(clog_type t); struct LogEntryKey { entity_inst_t who;