mirror of
https://github.com/ceph/ceph
synced 2025-02-20 09:27:35 +00:00
common: LogEntry: change field name from 'type' to 'prio' (aka priority)
Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
This commit is contained in:
parent
f25bca3136
commit
0d2a6c70a6
@ -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?
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user