Permalink
Browse files

console, feat: support for overloaded log behavior of logger.

  • Loading branch information...
xicilion committed Jun 28, 2018
1 parent f19a2bf commit 54f49bb7b0e0d6655fadc25c78c73ed99d7ddb62
Showing with 14 additions and 10 deletions.
  1. +14 −10 fibjs/include/console.h
View
@@ -155,19 +155,23 @@ class logger : public AsyncEvent {
public:
virtual result_t write(AsyncEvent* ac) = 0;
void log(int32_t priority, exlib::string& msg)
virtual void putLog(int32_t priority, exlib::string& msg)
{
if (priority >= 0 && priority < console_base::_NOTSET && m_levels[priority]) {
item* i = new item(priority, msg);
item* i = new item(priority, msg);
m_lock.lock();
m_acLog.putTail(i);
if (!m_bWorking) {
m_bWorking = true;
async(CALL_E_NOSYNC);
}
m_lock.unlock();
m_lock.lock();
m_acLog.putTail(i);
if (!m_bWorking) {
m_bWorking = true;
async(CALL_E_NOSYNC);
}
m_lock.unlock();
}
void log(int32_t priority, exlib::string& msg)
{
if (priority >= 0 && priority < console_base::_NOTSET && m_levels[priority])
putLog(priority, msg);
}
void flush()

0 comments on commit 54f49bb

Please sign in to comment.