mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-29 01:29:35 +08:00
1. renamed lib to to spitlog
2. Rotating bugfix
This commit is contained in:
@@ -1,33 +1,33 @@
|
||||
// example.cpp : Simple logger example
|
||||
//
|
||||
#include "c11log/logger.h"
|
||||
#include "c11log/sinks/async_sink.h"
|
||||
#include "c11log/sinks/file_sinks.h"
|
||||
#include "c11log/sinks/stdout_sinks.h"
|
||||
#include "c11log/sinks/null_sink.h"
|
||||
#include "spitlog/logger.h"
|
||||
#include "spitlog/sinks/async_sink.h"
|
||||
#include "spitlog/sinks/file_sinks.h"
|
||||
#include "spitlog/sinks/stdout_sinks.h"
|
||||
#include "spitlog/sinks/null_sink.h"
|
||||
#include "utils.h"
|
||||
#include "c11log/details/registry.h"
|
||||
#include "spitlog/details/registry.h"
|
||||
|
||||
using namespace std::chrono;
|
||||
using namespace c11log;
|
||||
using namespace spitlog;
|
||||
using namespace utils;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
try {
|
||||
const unsigned int howmany = argc <= 1 ? 500000 : atoi(argv[1]);
|
||||
const unsigned int howmany = argc <= 1 ? 1500000 : atoi(argv[1]);
|
||||
|
||||
//c11log::set_format("%t");
|
||||
auto console = c11log::create<sinks::stdout_sink_st>("reporter");
|
||||
//spitlog::set_format("%t");
|
||||
auto console = spitlog::create<sinks::stdout_sink_st>("reporter");
|
||||
//console->set_format("[%n %l] %t");
|
||||
console->set_level(c11log::level::INFO);
|
||||
console->set_level(spitlog::level::INFO);
|
||||
console->info("Starting bench with", howmany, "iterations..");
|
||||
|
||||
auto bench = c11log::create<sinks::rotating_file_sink_st>("bench", "myrotating", "txt", 1024 * 1024 * 1, 3, 0);
|
||||
auto bench = spitlog::create<sinks::rotating_file_sink_st>("bench", "myrotating", "txt", 1024 * 1024 * 1, 10, 0);
|
||||
|
||||
//auto bench = c11log::create<sinks::simple_file_sink_st>("bench", "simplelog.txt", 1);
|
||||
//auto bench = c11log::create<sinks::null_sink_st>("bench");
|
||||
//auto bench = spitlog::create<sinks::simple_file_sink_st>("bench", "simplelog.txt", 1);
|
||||
//auto bench = spitlog::create<sinks::null_sink_st>("bench");
|
||||
auto start = system_clock::now();
|
||||
for (unsigned int i = 0; i < howmany; ++i)
|
||||
{
|
||||
@@ -45,6 +45,7 @@ int main(int argc, char* argv[])
|
||||
catch (std::exception &ex)
|
||||
{
|
||||
std::cerr << "Exception: " << ex.what() << std::endl;
|
||||
perror("Last error");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@@ -3,11 +3,11 @@
|
||||
#define FFLOG_ENABLE_TRACE
|
||||
|
||||
#include <iostream>
|
||||
#include "c11log/logger.h"
|
||||
#include "c11log/sinks/stdout_sinks.h"
|
||||
#include "c11log/sinks/file_sinks.h"
|
||||
#include "spitlog/logger.h"
|
||||
#include "spitlog/sinks/stdout_sinks.h"
|
||||
#include "spitlog/sinks/file_sinks.h"
|
||||
using namespace std;
|
||||
using namespace c11log;
|
||||
using namespace spitlog;
|
||||
|
||||
|
||||
details::fast_oss f(const std::string& what)
|
||||
|
Reference in New Issue
Block a user