X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ceph%2Fsrc%2Fcommon%2FLogEntry.cc;h=d9100fc46a25669ece7450f1c7460a94d19f5833;hb=224ce89bce8186937e77bdbda572a650953f8c23;hp=40bdbea2b3ac72e929d6515ecabb684d0bf66b86;hpb=06dae762bfef1ba116dc58483c7b68b733d853e0;p=ceph.git diff --git a/ceph/src/common/LogEntry.cc b/ceph/src/common/LogEntry.cc index 40bdbea2b..d9100fc46 100644 --- a/ceph/src/common/LogEntry.cc +++ b/ceph/src/common/LogEntry.cc @@ -1,3 +1,6 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab +// #include #include @@ -36,6 +39,27 @@ void LogEntryKey::generate_test_instances(list& o) o.push_back(new LogEntryKey(entity_inst_t(), utime_t(1,2), 34)); } +clog_type LogEntry::str_to_level(std::string const &str) +{ + std::string level_str = str; + std::transform(level_str.begin(), level_str.end(), level_str.begin(), + [](char c) {return std::tolower(c);}); + + if (level_str == "debug") { + return CLOG_DEBUG; + } else if (level_str == "info") { + return CLOG_INFO; + } else if (level_str == "sec") { + return CLOG_SEC; + } else if (level_str == "warn" || level_str == "warning") { + return CLOG_WARN; + } else if (level_str == "error" || level_str == "err") { + return CLOG_ERROR; + } else { + return CLOG_UNKNOWN; + } +} + // ---- int clog_type_to_syslog_level(clog_type t) @@ -274,3 +298,4 @@ void LogSummary::generate_test_instances(list& o) o.push_back(new LogSummary); // more! } +