]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
log: prefix dump with line numbers
authorSage Weil <sage@newdream.net>
Fri, 20 Apr 2012 23:36:54 +0000 (16:36 -0700)
committerSage Weil <sage@newdream.net>
Fri, 20 Apr 2012 23:36:54 +0000 (16:36 -0700)
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>
src/log/Log.cc

index 38c875239b2d3ef40d9ad06703897b4bb8762a9f..9cb90c15422031cd2e0a278df1f6e4cf0bee7950 100644 (file)
@@ -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