bug fixed

This commit is contained in:
xiongziliang 2018-05-28 18:05:39 +08:00
parent fa6eedc46a
commit cea02a5b74

View File

@ -132,16 +132,16 @@ API_EXPORT void API_CALL log_setLevel(LogType level){
class LogoutChannel: public LogChannel { class LogoutChannel: public LogChannel {
public: public:
LogoutChannel(const string &name, onLogOut cb, LogLevel level = LDebug) LogoutChannel(const string &name, onLogOut cb, LogLevel level = LDebug)
:LogChannel(name, level, "%Y-%m-%d %H:%M:%S"){ :LogChannel(name, level){
_cb = cb; _cb = cb;
} }
virtual ~LogoutChannel(){} virtual ~LogoutChannel(){}
void write(const LogInfo_ptr &logInfo){ void write(const LogInfo_ptr &logInfo){
if (level() > logInfo->getLevel()) { if (level() > logInfo->_level) {
return; return;
} }
stringstream strStream; stringstream strStream;
logInfo->format(strStream, timeFormat().data(), false); logInfo->format(strStream, false);
auto strTmp = strStream.str(); auto strTmp = strStream.str();
if (_cb) { if (_cb) {
_cb(strTmp.data(), strTmp.size()); _cb(strTmp.data(), strTmp.size());