Skip to content

Commit

Permalink
log: move create_entry() into Log interface
Browse files Browse the repository at this point in the history
This will let us be smarter than putting it on the heap.

Signed-off-by: Sage Weil <[email protected]>
  • Loading branch information
liewegas committed Mar 27, 2012
1 parent 8c5046f commit 362ca19
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 1 addition & 3 deletions src/common/dout.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 7 additions & 0 deletions src/log/Log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/log/Log.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class Log : private Thread
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();
Expand Down

0 comments on commit 362ca19

Please sign in to comment.