summaryrefslogtreecommitdiff
path: root/src/log
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2012-04-20 16:36:54 -0700
committerSage Weil <sage@newdream.net>2012-04-20 16:36:54 -0700
commitf7699cc993c03305480b1a4df07dd3a82bbf8519 (patch)
treea13bd7d948a325e5c2bcdbf376fef0526f42ef2e /src/log
parenta68b3069de32ddc2fc6fa46ee414c5074a7fc82f (diff)
downloadceph-f7699cc993c03305480b1a4df07dd3a82bbf8519.tar.gz
log: prefix dump with line numbers
This makes it easier to interpret the dump, and makes it obvious what is dump (and potentially a dup of something that was already logged) and what is not. Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'src/log')
-rw-r--r--src/log/Log.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/log/Log.cc b/src/log/Log.cc
index 38c875239b2..9cb90c15422 100644
--- a/src/log/Log.cc
+++ b/src/log/Log.cc
@@ -185,8 +185,12 @@ void Log::_flush(EntryQueue *t, EntryQueue *requeue, bool crash)
bool do_stderr = (crash ? m_stderr_crash : m_stderr_log) >= e->m_prio;
if (do_fd || do_syslog || do_stderr) {
- int buflen = e->m_stamp.sprintf(buf, sizeof(buf));
- buflen += sprintf(buf + buflen, " %lx %2d ",
+ int buflen = 0;
+
+ if (crash)
+ buflen += snprintf(buf, sizeof(buf), "%6d> ", -t->m_len);
+ buflen += e->m_stamp.sprintf(buf + buflen, sizeof(buf)-buflen);
+ buflen += snprintf(buf + buflen, sizeof(buf)-buflen, " %lx %2d ",
(unsigned long)e->m_thread, e->m_prio);
// FIXME: this is slow