mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-29 01:29:35 +08:00
clang-format
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
*/
|
||||
#include "includes.h"
|
||||
|
||||
|
||||
TEST_CASE("simple_file_logger", "[simple_logger]]")
|
||||
{
|
||||
prepare_logdir();
|
||||
@@ -24,7 +23,6 @@ TEST_CASE("simple_file_logger", "[simple_logger]]")
|
||||
REQUIRE(count_lines(filename) == 2);
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("flush_on", "[flush_on]]")
|
||||
{
|
||||
prepare_logdir();
|
||||
@@ -69,7 +67,6 @@ TEST_CASE("rotating_file_logger1", "[rotating_logger]]")
|
||||
REQUIRE(count_lines(filename) == 10);
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("rotating_file_logger2", "[rotating_logger]]")
|
||||
{
|
||||
prepare_logdir();
|
||||
@@ -96,11 +93,10 @@ TEST_CASE("rotating_file_logger2", "[rotating_logger]]")
|
||||
REQUIRE(get_filesize(filename1) <= 1024);
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("daily_logger", "[daily_logger]]")
|
||||
{
|
||||
prepare_logdir();
|
||||
//calculate filename (time based)
|
||||
// calculate filename (time based)
|
||||
std::string basename = "logs/daily_log";
|
||||
std::tm tm = spdlog::details::os::localtime();
|
||||
fmt::MemoryWriter w;
|
||||
@@ -121,15 +117,12 @@ TEST_CASE("daily_logger", "[daily_logger]]")
|
||||
REQUIRE(count_lines(filename) == 10);
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("daily_logger with dateonly calculator", "[daily_logger_dateonly]]")
|
||||
{
|
||||
using sink_type = spdlog::sinks::daily_file_sink<
|
||||
std::mutex,
|
||||
spdlog::sinks::dateonly_daily_file_name_calculator>;
|
||||
using sink_type = spdlog::sinks::daily_file_sink<std::mutex, spdlog::sinks::dateonly_daily_file_name_calculator>;
|
||||
|
||||
prepare_logdir();
|
||||
//calculate filename (time based)
|
||||
// calculate filename (time based)
|
||||
std::string basename = "logs/daily_dateonly";
|
||||
std::tm tm = spdlog::details::os::localtime();
|
||||
fmt::MemoryWriter w;
|
||||
@@ -151,7 +144,7 @@ TEST_CASE("daily_logger with dateonly calculator", "[daily_logger_dateonly]]")
|
||||
|
||||
struct custom_daily_file_name_calculator
|
||||
{
|
||||
static spdlog::filename_t calc_filename(const spdlog::filename_t& basename)
|
||||
static spdlog::filename_t calc_filename(const spdlog::filename_t &basename)
|
||||
{
|
||||
std::tm tm = spdlog::details::os::localtime();
|
||||
fmt::MemoryWriter w;
|
||||
@@ -162,12 +155,10 @@ struct custom_daily_file_name_calculator
|
||||
|
||||
TEST_CASE("daily_logger with custom calculator", "[daily_logger_custom]]")
|
||||
{
|
||||
using sink_type = spdlog::sinks::daily_file_sink<
|
||||
std::mutex,
|
||||
custom_daily_file_name_calculator>;
|
||||
using sink_type = spdlog::sinks::daily_file_sink<std::mutex, custom_daily_file_name_calculator>;
|
||||
|
||||
prepare_logdir();
|
||||
//calculate filename (time based)
|
||||
// calculate filename (time based)
|
||||
std::string basename = "logs/daily_dateonly";
|
||||
std::tm tm = spdlog::details::os::localtime();
|
||||
fmt::MemoryWriter w;
|
||||
@@ -188,7 +179,6 @@ TEST_CASE("daily_logger with custom calculator", "[daily_logger_custom]]")
|
||||
REQUIRE(count_lines(filename) == 10);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* File name calculations
|
||||
*/
|
||||
@@ -211,12 +201,8 @@ TEST_CASE("rotating_file_sink::calc_filename3", "[rotating_file_sink]]")
|
||||
REQUIRE(filename == "rotated.txt");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// regex supported only from gcc 4.9 and above
|
||||
#if defined (_MSC_VER) || !(__GNUC__ <= 4 && __GNUC_MINOR__ < 9)
|
||||
#if defined(_MSC_VER) || !(__GNUC__ <= 4 && __GNUC_MINOR__ < 9)
|
||||
#include <regex>
|
||||
TEST_CASE("daily_file_sink::default_daily_file_name_calculator1", "[daily_file_sink]]")
|
||||
{
|
||||
|
Reference in New Issue
Block a user