]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
log: move create_entry() into Log interface
authorSage Weil <sage@newdream.net>
Mon, 26 Mar 2012 23:08:29 +0000 (16:08 -0700)
committerSage Weil <sage@newdream.net>
Tue, 27 Mar 2012 17:41:15 +0000 (10:41 -0700)
This will let us be smarter than putting it on the heap.

Signed-off-by: Sage Weil <sage@newdream.net>
src/common/dout.h
src/log/Log.cc
src/log/Log.h

index b38d367f7eee7b5d5e60eaaff7889896d19c0d6c..f4c317538eee2831e2feb451d57ec8b0afe09eec 100644 (file)
@@ -48,9 +48,7 @@ inline std::ostream& operator<<(std::ostream& out, _bad_endl_use_dendl_t) {
     if (0) {                                                           \
       char __array[((v >= -1) && (v <= 200)) ? 0 : -1] __attribute__((unused)); \
     }                                                                  \
-    ceph::log::Entry *_dout_e = new ceph::log::Entry(ceph_clock_now(cct), \
-                                                    pthread_self(),    \
-                                                    v, sub);           \
+    ceph::log::Entry *_dout_e = cct->_log->create_entry(v, sub);       \
     ostringstream _dout_ss;                                            \
     CephContext *_dout_cct = cct;                                      \
     std::ostream* _dout = &_dout_ss;
index 7f2a62fd3a5b463a90d7a5164ef232ce9b04c47f..d224bd813a3d6c7fa7d2de87055c67fb1c356a98 100644 (file)
@@ -114,6 +114,13 @@ void Log::submit_entry(Entry *e)
   pthread_mutex_unlock(&m_queue_mutex);
 }
 
+Entry *Log::create_entry(int level, int subsys)
+{
+  return new Entry(ceph_clock_now(NULL),
+                  pthread_self(),
+                  level, subsys);
+}
+
 void Log::flush()
 {
   pthread_mutex_lock(&m_flush_mutex);
index 13faac576cc695f94118c494e118134d38ad6f3d..c0c3a7e1f857d69ab18a7a4df0782cd16eb2cd87 100644 (file)
@@ -59,6 +59,7 @@ public:
   void set_syslog_level(int log, int crash);
   void set_stderr_level(int log, int crash);
 
+  Entry *create_entry(int level, int subsys);
   void submit_entry(Entry *e);
 
   void start();