Bug fixes
This commit is contained in:
parent
b94ca27ce4
commit
e5f4790407
@ -24,14 +24,14 @@ int main(int argc, char* argv[])
|
|||||||
console->set_level(c11log::level::INFO);
|
console->set_level(c11log::level::INFO);
|
||||||
console->info("Starting bench with", howmany, "iterations..");
|
console->info("Starting bench with", howmany, "iterations..");
|
||||||
|
|
||||||
//auto bench = c11log::create<sinks::rotating_file_sink_st>("bench", "myrotating", "txt", 1024 * 1024 * 5, 3, 0);
|
auto bench = c11log::create<sinks::rotating_file_sink_st>("bench", "myrotating", "txt", 1024 * 1024 * 5, 3, 0);
|
||||||
auto bench = c11log::create<sinks::daily_file_sink_mt>("bench", "sdfsfddaily", "txt", 0);
|
|
||||||
//auto bench = c11log::create<sinks::simple_file_sink_st>("bench", "simplelog.txt", 1);
|
//auto bench = c11log::create<sinks::simple_file_sink_st>("bench", "simplelog.txt", 1);
|
||||||
//auto bench = c11log::create<sinks::null_sink_st>("bench");
|
//auto bench = c11log::create<sinks::null_sink_st>("bench");
|
||||||
auto start = system_clock::now();
|
auto start = system_clock::now();
|
||||||
for (unsigned int i = 1; i <= howmany; ++i)
|
for (unsigned int i = 0; i < howmany; ++i)
|
||||||
{
|
{
|
||||||
c11log::get("bench")->info("Hello logger: msg number", i);
|
bench->info("Hello logger: msg number") << i;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto delta = system_clock::now() - start;
|
auto delta = system_clock::now() - start;
|
||||||
|
@ -115,8 +115,9 @@ void c11log::logger::_variadic_log(c11log::details::line_logger& l, const First&
|
|||||||
|
|
||||||
inline void c11log::logger::_log_msg(details::log_msg& msg)
|
inline void c11log::logger::_log_msg(details::log_msg& msg)
|
||||||
{
|
{
|
||||||
|
//Use default formatter if not set
|
||||||
if (!_formatter)
|
if (!_formatter)
|
||||||
_formatter = std::make_shared<pattern_formatter>("%+ %t");
|
_formatter = std::make_shared<pattern_formatter>("%+");
|
||||||
_formatter->format(msg);
|
_formatter->format(msg);
|
||||||
for (auto &sink : _sinks)
|
for (auto &sink : _sinks)
|
||||||
sink->log(msg);
|
sink->log(msg);
|
||||||
|
@ -93,7 +93,7 @@ constexpr inline unsigned short eol_size()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//fopen_s on non windows for writing
|
//fopen_s on non windows for writing
|
||||||
inline bool fopen_s(FILE** fp, const std::string& filename, const char* mode)
|
inline int fopen_s(FILE** fp, const std::string& filename, const char* mode)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
return ::fopen_s(fp, filename.c_str(), mode);
|
return ::fopen_s(fp, filename.c_str(), mode);
|
||||||
|
@ -366,11 +366,7 @@ class full_formatter :public flag_formatter
|
|||||||
auto millis = std::chrono::duration_cast<std::chrono::milliseconds>(duration).count() % 1000;
|
auto millis = std::chrono::duration_cast<std::chrono::milliseconds>(duration).count() % 1000;
|
||||||
msg.formatted.put_int(static_cast<int>(millis), 3);
|
msg.formatted.put_int(static_cast<int>(millis), 3);
|
||||||
msg.formatted.putc(']');
|
msg.formatted.putc(']');
|
||||||
msg.formatted << " [";
|
msg.formatted << " [" << msg.logger_name << "] [" << level::to_str(msg.level) << "] ";
|
||||||
msg.formatted << msg.logger_name;
|
|
||||||
msg.formatted << "] [";
|
|
||||||
msg.formatted << level::to_str(msg.level);
|
|
||||||
msg.formatted << "] ";
|
|
||||||
msg.formatted.put_fast_oss(msg.raw);
|
msg.formatted.put_fast_oss(msg.raw);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user