Code formatting

This commit is contained in:
gabime 2018-07-07 13:22:43 +03:00
parent a9a7309001
commit 39c6eb752a
7 changed files with 18 additions and 36 deletions

View File

@ -7,10 +7,10 @@
// bench.cpp : spdlog benchmarks
//
#include "spdlog/async.h"
#include "spdlog/sinks/basic_file_sink.h"
#include "spdlog/sinks/daily_file_sink.h"
#include "spdlog/sinks/null_sink.h"
#include "spdlog/sinks/rotating_file_sink.h"
#include "spdlog/sinks/basic_file_sink.h"
#include "spdlog/spdlog.h"
#include "utils.h"
#include <atomic>

View File

@ -7,7 +7,6 @@
//
//
#include <iostream>
void stdout_example();
@ -42,7 +41,6 @@ int main(int, char *[])
// custom error handler
err_handler_example();
// apply some function on all registered loggers
spdlog::apply_all([&](std::shared_ptr<spdlog::logger> l) { l->info("End of example."); });
@ -57,7 +55,6 @@ int main(int, char *[])
}
}
#include "spdlog/sinks/stdout_color_sinks.h" // or "/sinks/stdout_sinks.h" if no colors needed
void stdout_example()
@ -84,21 +81,16 @@ void stdout_example()
console->set_level(spdlog::level::trace); // Set specific logger's log level
console->debug("This message should be displayed..");
// Customize msg format for all loggers
spdlog::set_pattern("[%H:%M:%S %z] [%^---%L---%$] [thread %t] %v");
console->info("This an info message with custom format");
// Compile time log levels
// define SPDLOG_DEBUG_ON or SPDLOG_TRACE_ON
SPDLOG_TRACE(console, "Enabled only #ifdef SPDLOG_TRACE_ON..{} ,{}", 1, 3.23);
SPDLOG_DEBUG(console, "Enabled only #ifdef SPDLOG_DEBUG_ON.. {} ,{}", 1, 3.23);
}
#include "spdlog/sinks/basic_file_sink.h"
void basic_example()
{
@ -118,10 +110,8 @@ void daily_example()
{
// Create a daily logger - a new file is created every day on 2:30am
auto daily_logger = spdlog::daily_logger_mt("daily_logger", "logs/daily.txt", 2, 30);
}
#include "spdlog/async.h"
void async_example()
{
@ -137,8 +127,6 @@ void async_example()
}
}
// user defined types logging by implementing operator<<
#include "spdlog/fmt/ostr.h" // must be included
struct my_type
@ -151,7 +139,6 @@ struct my_type
}
};
void user_defined_example()
{
spdlog::get("console")->info("user defined type: {}", my_type{14});
@ -167,7 +154,6 @@ void err_handler_example()
spdlog::get("console")->info("some invalid message to trigger an error {}{}{}{}", 3);
}
// syslog example (linux/osx/freebsd)
#ifndef _WIN32
#include "spdlog/sinks/syslog_sink.h"

View File

@ -26,8 +26,6 @@ public:
file_helper_.open(filename, truncate);
}
protected:
void sink_it_(const details::log_msg &, const fmt::memory_buffer &formatted) override
{

View File

@ -60,7 +60,6 @@ public:
private:
Mutex mutex_;
std::vector<std::shared_ptr<sink>> sinks_;
};
using dist_sink_mt = dist_sink<std::mutex>;

View File

@ -60,7 +60,6 @@ public:
formatter_ = std::move(sink_formatter);
}
protected:
level_t level_{level::trace};
std::unique_ptr<spdlog::formatter> formatter_;

View File

@ -13,10 +13,10 @@
#define SPDLOG_DEBUG_ON
#include "spdlog/async.h"
#include "spdlog/sinks/basic_file_sink.h"
#include "spdlog/sinks/daily_file_sink.h"
#include "spdlog/sinks/null_sink.h"
#include "spdlog/sinks/ostream_sink.h"
#include "spdlog/sinks/rotating_file_sink.h"
#include "spdlog/sinks/basic_file_sink.h"
#include "spdlog/sinks/stdout_color_sinks.h"
#include "spdlog/spdlog.h"