This commit is contained in:
gabime
2014-01-27 11:44:10 +02:00
parent fa6f8b3c9a
commit 9934ea4044
11 changed files with 22 additions and 296 deletions

View File

@@ -9,8 +9,9 @@ namespace details {
class line_logger {
public:
c11log::details::line_logger::line_logger(logger* callback_logger, level::level_enum msg_level);
c11log::details::line_logger::line_logger(logger* callback_logger):_callback_logger(nullptr) {};
line_logger(logger* callback_logger, level::level_enum msg_level);
line_logger(logger* callback_logger):_callback_logger(nullptr) {};
line_logger(const line_logger&){};
~line_logger();
template<typename T>
@@ -27,4 +28,4 @@ private:
};
} //Namespace details
} // Namespace c11log
} // Namespace c11log

View File

@@ -14,6 +14,8 @@
#include "details/factory.h"
namespace c11log {
class logger {

View File

@@ -32,7 +32,7 @@ public:
protected:
virtual void sink_it_(const std::string& msg) = 0;
std::atomic<int> _level = level::INFO;
std::atomic<int> _level{level::INFO};
};
class null_sink:public base_sink {
@@ -41,4 +41,4 @@ protected:
{}
};
}
}
}

View File

@@ -150,9 +150,10 @@ private:
static std::string _calc_filename(const std::string& basename, const std::string& extension)
{
std::ostringstream oss;
std::tm now_tm = c11log::details::os::localtime();
oss << basename << std::put_time(&now_tm, ".%Y-%m-%d.") << extension;
return oss.str();
std::tm tm = c11log::details::os::localtime();
char buf[32];
sprintf(buf, ".%Y-%m-%d.", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday);
return buf;
}
std::string _base_filename;
@@ -162,4 +163,4 @@ private:
std::mutex mutex_;
};
}
}
}