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?
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;
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());
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);
::decode(stamp, bl);
::decode(seq, bl);
::decode(t, bl);
- type = (clog_type)t;
+ prio = (clog_type)t;
::decode(msg, bl);
DECODE_FINISH(bl);
}
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);
}
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); }
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
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);
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();
}
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";
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));
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);
<< " 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();
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;
}
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);
}