From: Joao Eduardo Luis Date: Wed, 16 Jul 2014 17:00:44 +0000 (+0100) Subject: common: LogEntry: change field name from 'type' to 'prio' (aka priority) X-Git-Tag: v0.86~167^2~19 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0d2a6c70a61fef6daecd56788b7c6d91fdc5a0e6;p=ceph.git common: LogEntry: change field name from 'type' to 'prio' (aka priority) Signed-off-by: Joao Eduardo Luis --- diff --git a/src/common/LogClient.cc b/src/common/LogClient.cc index afa1a27602a2..4c845965ab30 100644 --- a/src/common/LogClient.cc +++ b/src/common/LogClient.cc @@ -63,26 +63,26 @@ LogClientTemp::~LogClientTemp() parent.do_log(type, ss); } -void LogClient::do_log(clog_type type, std::stringstream& ss) +void LogClient::do_log(clog_type prio, std::stringstream& ss) { while (!ss.eof()) { string s; getline(ss, s); if (!s.empty()) - do_log(type, s); + do_log(prio, s); } } -void LogClient::do_log(clog_type type, const std::string& s) +void LogClient::do_log(clog_type prio, const std::string& s) { Mutex::Locker l(log_lock); - int lvl = (type == CLOG_ERROR ? -1 : 0); - ldout(cct,lvl) << "log " << type << " : " << s << dendl; + int lvl = (prio == CLOG_ERROR ? -1 : 0); + ldout(cct,lvl) << "log " << prio << " : " << s << dendl; LogEntry e; e.who = messenger->get_myinst(); e.stamp = ceph_clock_now(cct); e.seq = ++last_log; - e.type = type; + e.prio = prio; e.msg = s; // log to syslog? diff --git a/src/common/LogClient.h b/src/common/LogClient.h index d62147e4a993..5e736550652c 100644 --- a/src/common/LogClient.h +++ b/src/common/LogClient.h @@ -97,8 +97,8 @@ public: bool are_pending(); private: - void do_log(clog_type type, std::stringstream& ss); - void do_log(clog_type type, const std::string& s); + void do_log(clog_type prio, std::stringstream& ss); + void do_log(clog_type prio, const std::string& s); Message *_get_mon_log_message(); CephContext *cct; diff --git a/src/common/LogEntry.cc b/src/common/LogEntry.cc index 97b173f1fd87..a5fd96e2db59 100644 --- a/src/common/LogEntry.cc +++ b/src/common/LogEntry.cc @@ -133,7 +133,7 @@ int string_to_syslog_facility(string s) void LogEntry::log_to_syslog(string level, string facility) { int min = string_to_syslog_level(level); - int l = clog_type_to_syslog_level(type); + int l = clog_type_to_syslog_level(prio); if (l <= min) { int f = string_to_syslog_facility(facility); syslog(l | f, "%s", stringify(*this).c_str()); @@ -143,7 +143,7 @@ void LogEntry::log_to_syslog(string level, string facility) void LogEntry::encode(bufferlist& bl) const { ENCODE_START(2, 2, bl); - __u16 t = type; + __u16 t = prio; ::encode(who, bl); ::encode(stamp, bl); ::encode(seq, bl); @@ -160,7 +160,7 @@ void LogEntry::decode(bufferlist::iterator& bl) ::decode(stamp, bl); ::decode(seq, bl); ::decode(t, bl); - type = (clog_type)t; + prio = (clog_type)t; ::decode(msg, bl); DECODE_FINISH(bl); } @@ -170,7 +170,7 @@ void LogEntry::dump(Formatter *f) const f->dump_stream("who") << who; f->dump_stream("stamp") << stamp; f->dump_unsigned("seq", seq); - f->dump_stream("type") << type; + f->dump_stream("priority") << prio; f->dump_string("message", msg); } diff --git a/src/common/LogEntry.h b/src/common/LogEntry.h index 58022fe27b63..86a7fec88f78 100644 --- a/src/common/LogEntry.h +++ b/src/common/LogEntry.h @@ -64,7 +64,7 @@ struct LogEntry { entity_inst_t who; utime_t stamp; uint64_t seq; - clog_type type; + clog_type prio; string msg; LogEntryKey key() const { return LogEntryKey(who, stamp, seq); } @@ -125,7 +125,8 @@ inline ostream& operator<<(ostream& out, clog_type t) inline ostream& operator<<(ostream& out, const LogEntry& e) { - return out << e.stamp << " " << e.who << " " << e.seq << " : " << e.type << " " << e.msg; + return out << e.stamp << " " << e.who << " " << e.seq << " : " + << e.prio << " " << e.msg; } #endif diff --git a/src/librados/RadosClient.cc b/src/librados/RadosClient.cc index 356588170289..6aeba57c14e6 100644 --- a/src/librados/RadosClient.cc +++ b/src/librados/RadosClient.cc @@ -870,10 +870,10 @@ void librados::RadosClient::handle_log(MLog *m) for (std::deque::iterator it = m->entries.begin(); it != m->entries.end(); ++it) { LogEntry e = *it; ostringstream ss; - ss << e.stamp << " " << e.who.name << " " << e.type << " " << e.msg; + ss << e.stamp << " " << e.who.name << " " << e.prio << " " << e.msg; string line = ss.str(); string who = stringify(e.who); - string level = stringify(e.type); + string level = stringify(e.prio); struct timespec stamp; e.stamp.to_timespec(&stamp); diff --git a/src/mon/LogMonitor.cc b/src/mon/LogMonitor.cc index fc46bd26f795..cfafd279c2a2 100644 --- a/src/mon/LogMonitor.cc +++ b/src/mon/LogMonitor.cc @@ -84,7 +84,7 @@ void LogMonitor::create_initial() LogEntry e; memset(&e.who, 0, sizeof(e.who)); e.stamp = ceph_clock_now(g_ceph_context); - e.type = CLOG_INFO; + e.prio = CLOG_INFO; std::stringstream ss; ss << "mkfs " << mon->monmap->get_fsid(); e.msg = ss.str(); @@ -137,7 +137,7 @@ void LogMonitor::update_from_paxos(bool *need_bootstrap) } if (g_conf->mon_cluster_log_file.length()) { int min = string_to_syslog_level(g_conf->mon_cluster_log_file_level); - int l = clog_type_to_syslog_level(le.type); + int l = clog_type_to_syslog_level(le.prio); if (l <= min) { stringstream ss; ss << le << "\n"; @@ -378,7 +378,7 @@ bool LogMonitor::prepare_command(MMonCommand *m) le.who = m->get_orig_source_inst(); le.stamp = m->get_recv_stamp(); le.seq = 0; - le.type = CLOG_INFO; + le.prio = CLOG_INFO; le.msg = str_join(logtext, " "); pending_summary.add(le); pending_log.insert(pair(le.stamp, le)); @@ -483,7 +483,7 @@ bool LogMonitor::_create_sub_summary(MLog *mlog, int level) list::reverse_iterator it = summary.tail.rbegin(); for (; it != summary.tail.rend(); ++it) { LogEntry e = *it; - if (e.type < level) + if (e.prio < level) continue; mlog->entries.push_back(e); @@ -512,7 +512,7 @@ void LogMonitor::_create_sub_incremental(MLog *mlog, int level, version_t sv) << " to first_committed " << get_first_committed() << dendl; LogEntry le; le.stamp = ceph_clock_now(NULL); - le.type = CLOG_WARN; + le.prio = CLOG_WARN; ostringstream ss; ss << "skipped log messages from " << sv << " to " << get_first_committed(); le.msg = ss.str(); @@ -533,9 +533,9 @@ void LogMonitor::_create_sub_incremental(MLog *mlog, int level, version_t sv) LogEntry le; le.decode(p); - if (le.type < level) { + if (le.prio < level) { dout(20) << __func__ << " requested " << level - << " entry " << le.type << dendl; + << " entry " << le.prio << dendl; continue; } diff --git a/src/test/mon/test_mon_workloadgen.cc b/src/test/mon/test_mon_workloadgen.cc index d7537b5a5e60..a09676ef6d05 100644 --- a/src/test/mon/test_mon_workloadgen.cc +++ b/src/test/mon/test_mon_workloadgen.cc @@ -706,7 +706,7 @@ class OSDStub : public TestStub e.who = messenger->get_myinst(); e.stamp = now; e.seq = seq++; - e.type = CLOG_DEBUG; + e.prio = CLOG_DEBUG; e.msg = "OSDStub::op_log"; m->entries.push_back(e); }