]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common: LogEntry: change field name from 'type' to 'prio' (aka priority)
authorJoao Eduardo Luis <joao.luis@inktank.com>
Wed, 16 Jul 2014 17:00:44 +0000 (18:00 +0100)
committerJoao Eduardo Luis <joao.luis@inktank.com>
Wed, 27 Aug 2014 17:21:47 +0000 (18:21 +0100)
Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
src/common/LogClient.cc
src/common/LogClient.h
src/common/LogEntry.cc
src/common/LogEntry.h
src/librados/RadosClient.cc
src/mon/LogMonitor.cc
src/test/mon/test_mon_workloadgen.cc

index afa1a27602a2e005891c83e7d08f4bd07b53eba9..4c845965ab30c5041cd05f422bf6273b2e64cf9f 100644 (file)
@@ -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?
index d62147e4a993f56d60f94fb29ac66804e73a7175..5e736550652cabbcd58468de17b3de61b340bc7a 100644 (file)
@@ -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;
index 97b173f1fd87918de979fdaa7ea7238b4fb0214c..a5fd96e2db59357e5fd4781da6b5cef254de3460 100644 (file)
@@ -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);
 }
 
index 58022fe27b63dd7f024468fcc1d7b2b9a2c1fda6..86a7fec88f78051baec5c6ba6f8dc9d7bba47764 100644 (file)
@@ -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
index 356588170289dac6d0c17161ebbe56b04d46e27a..6aeba57c14e67719224b63e1e378f2251417c099 100644 (file)
@@ -870,10 +870,10 @@ void librados::RadosClient::handle_log(MLog *m)
       for (std::deque<LogEntry>::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);
 
index fc46bd26f79573f3f318c2db240e912912eea5db..cfafd279c2a212b8269c7b5882467302a0c80739 100644 (file)
@@ -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<utime_t,LogEntry>(le.stamp, le));
@@ -483,7 +483,7 @@ bool LogMonitor::_create_sub_summary(MLog *mlog, int level)
   list<LogEntry>::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;
       }
 
index d7537b5a5e608a69db26376eb4b873b55fcd30d8..a09676ef6d05d5a7fd0823cbd03951adcd53a66e 100644 (file)
@@ -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);
     }