Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
spdlog
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
spdlog
Commits
f14d1c00
Commit
f14d1c00
authored
Oct 12, 2016
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
astyle
parent
0cfdad4d
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
250 additions
and
250 deletions
+250
-250
bench/latency/g3log-crush.cpp
bench/latency/g3log-crush.cpp
+8
-8
bench/spdlog-null-async.cpp
bench/spdlog-null-async.cpp
+2
-2
example/example.cpp
example/example.cpp
+9
-9
include/spdlog/details/file_helper.h
include/spdlog/details/file_helper.h
+3
-3
include/spdlog/details/spdlog_impl.h
include/spdlog/details/spdlog_impl.h
+46
-46
include/spdlog/sinks/file_sinks.h
include/spdlog/sinks/file_sinks.h
+9
-9
include/spdlog/sinks/stdout_sinks.h
include/spdlog/sinks/stdout_sinks.h
+51
-51
include/spdlog/sinks/wincolor_sink.h
include/spdlog/sinks/wincolor_sink.h
+98
-98
tests/errors.cpp
tests/errors.cpp
+1
-1
tests/file_helper.cpp
tests/file_helper.cpp
+3
-3
tests/file_log.cpp
tests/file_log.cpp
+20
-20
No files found.
bench/latency/g3log-crush.cpp
View file @
f14d1c00
...
...
@@ -5,10 +5,10 @@
void
CrusherLoop
()
{
size_t
counter
=
0
;
size_t
counter
=
0
;
while
(
true
)
{
LOGF
(
INFO
,
"Some text to crush you machine. thread:"
);
LOGF
(
INFO
,
"Some text to crush you machine. thread:"
);
if
(
++
counter
%
1000000
==
0
)
{
std
::
cout
<<
"Wrote "
<<
counter
<<
" entries"
<<
std
::
endl
;
...
...
@@ -24,13 +24,13 @@ int main(int argc, char** argv)
char
c
;
std
::
cin
>>
c
;
if
(
toupper
(
c
)
!=
'Y'
)
return
0
;
auto
worker
=
g3
::
LogWorker
::
createLogWorker
();
return
0
;
auto
worker
=
g3
::
LogWorker
::
createLogWorker
();
auto
handle
=
worker
->
addDefaultLogger
(
argv
[
0
],
"g3log.txt"
);
g3
::
initializeLogging
(
worker
.
get
());
CrusherLoop
();
g3
::
initializeLogging
(
worker
.
get
());
CrusherLoop
();
return
0
;
}
...
...
bench/spdlog-null-async.cpp
View file @
f14d1c00
...
...
@@ -46,7 +46,7 @@ int main(int argc, char* argv[])
if
(
argc
>
3
)
queue_size
=
atoi
(
argv
[
3
]);
cout
<<
"
\n
*******************************************************************************
\n
"
;
cout
<<
"async logging.. "
<<
threads
<<
" threads sharing same logger, "
<<
format
(
howmany
)
<<
" messages "
<<
endl
;
cout
<<
"*******************************************************************************
\n
"
;
...
...
@@ -64,7 +64,7 @@ int main(int argc, char* argv[])
}
std
::
cout
<<
endl
;
std
::
cout
<<
"Avg rate: "
<<
format
(
total_rate
/
iters
)
<<
"/sec"
<<
std
::
endl
;
}
catch
(
std
::
exception
&
ex
)
{
...
...
example/example.cpp
View file @
f14d1c00
...
...
@@ -22,10 +22,10 @@ int main(int, char*[])
{
try
{
// Console logger with color
// Console logger with color
auto
console
=
spd
::
stdout_color_mt
(
"console"
);
console
->
info
(
"Welcome to spdlog!"
);
console
->
error
(
"Some error message with arg{}.."
,
1
);
console
->
error
(
"Some error message with arg{}.."
,
1
);
// Formatting examples
console
->
warn
(
"Easy padding in numbers like {:08d}"
,
12
);
...
...
@@ -33,11 +33,11 @@ int main(int, char*[])
console
->
info
(
"Support for floats {:03.2f}"
,
1.23456
);
console
->
info
(
"Positional args are {1} {0}.."
,
"too"
,
"supported"
);
console
->
info
(
"{:<30}"
,
"left aligned"
);
spd
::
get
(
"console"
)
->
info
(
"loggers can be retrieved from a global registry using the spdlog::get(logger_name) function"
);
// Create basic file logger (not rotated)
auto
my_logger
=
spd
::
basic_logger_mt
(
"basic_logger"
,
"logs/basic.txt"
);
my_logger
->
info
(
"Some log message"
);
...
...
@@ -58,11 +58,11 @@ int main(int, char*[])
rotating_logger
->
info
(
"This is another message with custom format"
);
// Runtime log levels
spd
::
set_level
(
spd
::
level
::
info
);
//Set global log level to info
console
->
debug
(
"This message shold not be displayed!"
);
console
->
set_level
(
spd
::
level
::
debug
);
// Set specific logger's log level
console
->
debug
(
"This message shold be displayed.."
);
// Runtime log levels
spd
::
set_level
(
spd
::
level
::
info
);
//Set global log level to info
console
->
debug
(
"This message shold not be displayed!"
);
console
->
set_level
(
spd
::
level
::
debug
);
// Set specific logger's log level
console
->
debug
(
"This message shold be displayed.."
);
// Compile time log levels
// define SPDLOG_DEBUG_ON or SPDLOG_TRACE_ON
...
...
include/spdlog/details/file_helper.h
View file @
f14d1c00
...
...
@@ -32,7 +32,7 @@ public:
const
int
open_interval
=
10
;
explicit
file_helper
()
:
_fd
(
nullptr
)
_fd
(
nullptr
)
{}
file_helper
(
const
file_helper
&
)
=
delete
;
...
...
@@ -89,7 +89,7 @@ public:
size_t
msg_size
=
msg
.
formatted
.
size
();
auto
data
=
msg
.
formatted
.
data
();
if
(
std
::
fwrite
(
data
,
1
,
msg_size
,
_fd
)
!=
msg_size
)
throw
spdlog_ex
(
"Failed writing to file "
+
os
::
filename_to_str
(
_filename
),
errno
);
throw
spdlog_ex
(
"Failed writing to file "
+
os
::
filename_to_str
(
_filename
),
errno
);
}
size_t
size
()
...
...
@@ -112,7 +112,7 @@ public:
private:
FILE
*
_fd
;
filename_t
_filename
;
filename_t
_filename
;
};
}
}
include/spdlog/details/spdlog_impl.h
View file @
f14d1c00
This diff is collapsed.
Click to expand it.
include/spdlog/sinks/file_sinks.h
View file @
f14d1c00
...
...
@@ -37,21 +37,21 @@ public:
{
_file_helper
.
flush
();
}
void
set_force_flush
(
bool
force_flush
)
{
_force_flush
=
force_flush
;
}
void
set_force_flush
(
bool
force_flush
)
{
_force_flush
=
force_flush
;
}
protected:
void
_sink_it
(
const
details
::
log_msg
&
msg
)
override
{
_file_helper
.
write
(
msg
);
if
(
_force_flush
)
_file_helper
.
flush
();
_file_helper
.
write
(
msg
);
if
(
_force_flush
)
_file_helper
.
flush
();
}
private:
details
::
file_helper
_file_helper
;
bool
_force_flush
;
bool
_force_flush
;
};
typedef
simple_file_sink
<
std
::
mutex
>
simple_file_sink_mt
;
...
...
@@ -190,7 +190,7 @@ public:
int
rotation_minute
)
:
_base_filename
(
base_filename
),
_extension
(
extension
),
_rotation_h
(
rotation_hour
),
_rotation_m
(
rotation_minute
)
_rotation_m
(
rotation_minute
)
{
if
(
rotation_hour
<
0
||
rotation_hour
>
23
||
rotation_minute
<
0
||
rotation_minute
>
59
)
throw
spdlog_ex
(
"daily_file_sink: Invalid rotation time in ctor"
);
...
...
include/spdlog/sinks/stdout_sinks.h
View file @
f14d1c00
...
...
@@ -14,64 +14,64 @@
namespace
spdlog
{
namespace
sinks
{
namespace
sinks
{
template
<
class
Mutex
>
class
stdout_sink
:
public
base_sink
<
Mutex
>
{
using
MyType
=
stdout_sink
<
Mutex
>
;
public:
stdout_sink
()
{}
static
std
::
shared_ptr
<
MyType
>
instance
()
{
static
std
::
shared_ptr
<
MyType
>
instance
=
std
::
make_shared
<
MyType
>
();
return
instance
;
}
template
<
class
Mutex
>
class
stdout_sink
:
public
base_sink
<
Mutex
>
{
using
MyType
=
stdout_sink
<
Mutex
>
;
public:
stdout_sink
()
{}
static
std
::
shared_ptr
<
MyType
>
instance
()
{
static
std
::
shared_ptr
<
MyType
>
instance
=
std
::
make_shared
<
MyType
>
();
return
instance
;
}
void
_sink_it
(
const
details
::
log_msg
&
msg
)
override
{
fwrite
(
msg
.
formatted
.
data
(),
sizeof
(
char
),
msg
.
formatted
.
size
(),
stdout
);
flush
();
}
void
_sink_it
(
const
details
::
log_msg
&
msg
)
override
{
fwrite
(
msg
.
formatted
.
data
(),
sizeof
(
char
),
msg
.
formatted
.
size
(),
stdout
);
flush
();
}
void
flush
()
override
{
fflush
(
stdout
);
}
};
void
flush
()
override
{
fflush
(
stdout
);
}
};
typedef
stdout_sink
<
details
::
null_mutex
>
stdout_sink_st
;
typedef
stdout_sink
<
std
::
mutex
>
stdout_sink_mt
;
typedef
stdout_sink
<
details
::
null_mutex
>
stdout_sink_st
;
typedef
stdout_sink
<
std
::
mutex
>
stdout_sink_mt
;
template
<
class
Mutex
>
class
stderr_sink
:
public
base_sink
<
Mutex
>
{
using
MyType
=
stderr_sink
<
Mutex
>
;
public:
stderr_sink
()
{}
static
std
::
shared_ptr
<
MyType
>
instance
()
{
static
std
::
shared_ptr
<
MyType
>
instance
=
std
::
make_shared
<
MyType
>
();
return
instance
;
}
template
<
class
Mutex
>
class
stderr_sink
:
public
base_sink
<
Mutex
>
{
using
MyType
=
stderr_sink
<
Mutex
>
;
public:
stderr_sink
()
{}
static
std
::
shared_ptr
<
MyType
>
instance
()
{
static
std
::
shared_ptr
<
MyType
>
instance
=
std
::
make_shared
<
MyType
>
();
return
instance
;
}
void
_sink_it
(
const
details
::
log_msg
&
msg
)
override
{
fwrite
(
msg
.
formatted
.
data
(),
sizeof
(
char
),
msg
.
formatted
.
size
(),
stderr
);
flush
();
}
void
_sink_it
(
const
details
::
log_msg
&
msg
)
override
{
fwrite
(
msg
.
formatted
.
data
(),
sizeof
(
char
),
msg
.
formatted
.
size
(),
stderr
);
flush
();
}
void
flush
()
override
{
fflush
(
stderr
);
}
};
void
flush
()
override
{
fflush
(
stderr
);
}
};
typedef
stderr_sink
<
std
::
mutex
>
stderr_sink_mt
;
typedef
stderr_sink
<
details
::
null_mutex
>
stderr_sink_st
;
}
typedef
stderr_sink
<
std
::
mutex
>
stderr_sink_mt
;
typedef
stderr_sink
<
details
::
null_mutex
>
stderr_sink_st
;
}
}
include/spdlog/sinks/wincolor_sink.h
View file @
f14d1c00
...
...
@@ -16,101 +16,101 @@
namespace
spdlog
{
namespace
sinks
{
/*
* Windows color console sink. Uses WriteConsoleA to write to the console with colors
*/
template
<
class
Mutex
>
class
wincolor_sink
:
public
base_sink
<
Mutex
>
{
public:
const
WORD
BOLD
=
FOREGROUND_INTENSITY
;
const
WORD
RED
=
FOREGROUND_RED
;
const
WORD
CYAN
=
FOREGROUND_GREEN
|
FOREGROUND_BLUE
;
const
WORD
WHITE
=
FOREGROUND_RED
|
FOREGROUND_GREEN
|
FOREGROUND_BLUE
;
const
WORD
YELLOW
=
FOREGROUND_RED
|
FOREGROUND_GREEN
;
wincolor_sink
(
HANDLE
std_handle
)
:
out_handle_
(
std_handle
)
{
colors_
[
level
::
trace
]
=
CYAN
;
colors_
[
level
::
debug
]
=
CYAN
;
colors_
[
level
::
info
]
=
WHITE
|
BOLD
;
colors_
[
level
::
warn
]
=
YELLOW
|
BOLD
;
colors_
[
level
::
err
]
=
RED
|
BOLD
;
// red bold
colors_
[
level
::
critical
]
=
BACKGROUND_RED
|
WHITE
|
BOLD
;
// white bold on red background
colors_
[
level
::
off
]
=
0
;
}
virtual
~
wincolor_sink
()
{
flush
();
}
wincolor_sink
(
const
wincolor_sink
&
other
)
=
delete
;
wincolor_sink
&
operator
=
(
const
wincolor_sink
&
other
)
=
delete
;
virtual
void
_sink_it
(
const
details
::
log_msg
&
msg
)
override
{
auto
color
=
colors_
[
msg
.
level
];
auto
orig_attribs
=
set_console_attribs
(
color
);
WriteConsoleA
(
out_handle_
,
msg
.
formatted
.
data
(),
msg
.
formatted
.
size
(),
nullptr
,
nullptr
);
SetConsoleTextAttribute
(
out_handle_
,
orig_attribs
);
//reset to orig colors
}
virtual
void
flush
()
override
{
// windows console always flushed?
}
// change the color for the given level
void
set_color
(
level
::
level_enum
level
,
WORD
color
)
{
std
::
lock_guard
<
Mutex
>
lock
(
_mutex
);
colors_
[
level
]
=
color
;
}
private:
HANDLE
out_handle_
;
std
::
map
<
level
::
level_enum
,
WORD
>
colors_
;
// set color and return the orig console attributes (for resetting later)
WORD
set_console_attribs
(
WORD
attribs
)
{
CONSOLE_SCREEN_BUFFER_INFO
orig_buffer_info
;
GetConsoleScreenBufferInfo
(
out_handle_
,
&
orig_buffer_info
);
SetConsoleTextAttribute
(
out_handle_
,
attribs
);
return
orig_buffer_info
.
wAttributes
;
//return orig attribs
}
};
//
// windows color console to stdout
//
template
<
class
Mutex
>
class
wincolor_stdout_sink
:
public
wincolor_sink
<
Mutex
>
{
public:
wincolor_stdout_sink
()
:
wincolor_sink
(
GetStdHandle
(
STD_OUTPUT_HANDLE
))
{}
};
typedef
wincolor_stdout_sink
<
std
::
mutex
>
wincolor_stdout_sink_mt
;
typedef
wincolor_stdout_sink
<
details
::
null_mutex
>
wincolor_stdout_sink_st
;
//
// windows color console to stderr
//
template
<
class
Mutex
>
class
wincolor_stderr_sink
:
public
wincolor_sink
<
Mutex
>
{
public:
wincolor_stderr_sink
()
:
wincolor_sink
(
GetStdHandle
(
STD_ERROR_HANDLE
))
{}
};
typedef
wincolor_stderr_sink
<
std
::
mutex
>
wincolor_stderr_sink_mt
;
typedef
wincolor_stderr_sink
<
details
::
null_mutex
>
wincolor_stderr_sink_st
;
}
}
\ No newline at end of file
namespace
sinks
{
/*
* Windows color console sink. Uses WriteConsoleA to write to the console with colors
*/
template
<
class
Mutex
>
class
wincolor_sink
:
public
base_sink
<
Mutex
>
{
public:
const
WORD
BOLD
=
FOREGROUND_INTENSITY
;
const
WORD
RED
=
FOREGROUND_RED
;
const
WORD
CYAN
=
FOREGROUND_GREEN
|
FOREGROUND_BLUE
;
const
WORD
WHITE
=
FOREGROUND_RED
|
FOREGROUND_GREEN
|
FOREGROUND_BLUE
;
const
WORD
YELLOW
=
FOREGROUND_RED
|
FOREGROUND_GREEN
;
wincolor_sink
(
HANDLE
std_handle
)
:
out_handle_
(
std_handle
)
{
colors_
[
level
::
trace
]
=
CYAN
;
colors_
[
level
::
debug
]
=
CYAN
;
colors_
[
level
::
info
]
=
WHITE
|
BOLD
;
colors_
[
level
::
warn
]
=
YELLOW
|
BOLD
;
colors_
[
level
::
err
]
=
RED
|
BOLD
;
// red bold
colors_
[
level
::
critical
]
=
BACKGROUND_RED
|
WHITE
|
BOLD
;
// white bold on red background
colors_
[
level
::
off
]
=
0
;
}
virtual
~
wincolor_sink
()
{
flush
();
}
wincolor_sink
(
const
wincolor_sink
&
other
)
=
delete
;
wincolor_sink
&
operator
=
(
const
wincolor_sink
&
other
)
=
delete
;
virtual
void
_sink_it
(
const
details
::
log_msg
&
msg
)
override
{
auto
color
=
colors_
[
msg
.
level
];
auto
orig_attribs
=
set_console_attribs
(
color
);
WriteConsoleA
(
out_handle_
,
msg
.
formatted
.
data
(),
msg
.
formatted
.
size
(),
nullptr
,
nullptr
);
SetConsoleTextAttribute
(
out_handle_
,
orig_attribs
);
//reset to orig colors
}
virtual
void
flush
()
override
{
// windows console always flushed?
}
// change the color for the given level
void
set_color
(
level
::
level_enum
level
,
WORD
color
)
{
std
::
lock_guard
<
Mutex
>
lock
(
_mutex
);
colors_
[
level
]
=
color
;
}
private:
HANDLE
out_handle_
;
std
::
map
<
level
::
level_enum
,
WORD
>
colors_
;
// set color and return the orig console attributes (for resetting later)
WORD
set_console_attribs
(
WORD
attribs
)
{
CONSOLE_SCREEN_BUFFER_INFO
orig_buffer_info
;
GetConsoleScreenBufferInfo
(
out_handle_
,
&
orig_buffer_info
);
SetConsoleTextAttribute
(
out_handle_
,
attribs
);
return
orig_buffer_info
.
wAttributes
;
//return orig attribs
}
};
//
// windows color console to stdout
//
template
<
class
Mutex
>
class
wincolor_stdout_sink
:
public
wincolor_sink
<
Mutex
>
{
public:
wincolor_stdout_sink
()
:
wincolor_sink
(
GetStdHandle
(
STD_OUTPUT_HANDLE
))
{}
};
typedef
wincolor_stdout_sink
<
std
::
mutex
>
wincolor_stdout_sink_mt
;
typedef
wincolor_stdout_sink
<
details
::
null_mutex
>
wincolor_stdout_sink_st
;
//
// windows color console to stderr
//
template
<
class
Mutex
>
class
wincolor_stderr_sink
:
public
wincolor_sink
<
Mutex
>
{
public:
wincolor_stderr_sink
()
:
wincolor_sink
(
GetStdHandle
(
STD_ERROR_HANDLE
))
{}
};
typedef
wincolor_stderr_sink
<
std
::
mutex
>
wincolor_stderr_sink_mt
;
typedef
wincolor_stderr_sink
<
details
::
null_mutex
>
wincolor_stderr_sink_st
;
}
}
\ No newline at end of file
tests/errors.cpp
View file @
f14d1c00
...
...
@@ -28,7 +28,7 @@ TEST_CASE("custom_error_handler", "[errors]]")
prepare_logdir
();
std
::
string
filename
=
"logs/simple_log.txt"
;
auto
logger
=
spdlog
::
create
<
spdlog
::
sinks
::
simple_file_sink_mt
>
(
"logger"
,
filename
,
true
);
logger
->
flush_on
(
spdlog
::
level
::
info
);
logger
->
flush_on
(
spdlog
::
level
::
info
);
logger
->
set_error_handler
([
=
](
const
std
::
string
&
msg
)
{
throw
custom_ex
();
...
...
tests/file_helper.cpp
View file @
f14d1c00
...
...
@@ -12,7 +12,7 @@ static void write_with_helper(file_helper &helper, size_t howmany)
log_msg
msg
;
msg
.
formatted
<<
std
::
string
(
howmany
,
'1'
);
helper
.
write
(
msg
);
helper
.
flush
();
helper
.
flush
();
}
...
...
@@ -45,7 +45,7 @@ TEST_CASE("file_helper_exists", "[file_helper::file_exists()]]")
{
prepare_logdir
();
REQUIRE
(
!
file_helper
::
file_exists
(
target_filename
));
file_helper
helper
;
file_helper
helper
;
helper
.
open
(
target_filename
);
REQUIRE
(
file_helper
::
file_exists
(
target_filename
));
}
...
...
@@ -65,7 +65,7 @@ TEST_CASE("file_helper_reopen2", "[file_helper::reopen(false)]]")
{
prepare_logdir
();
size_t
expected_size
=
14
;
file_helper
helper
;
file_helper
helper
;
helper
.
open
(
target_filename
);
write_with_helper
(
helper
,
expected_size
);
REQUIRE
(
helper
.
size
()
==
expected_size
);
...
...
tests/file_log.cpp
View file @
f14d1c00
...
...
@@ -23,21 +23,21 @@ TEST_CASE("simple_file_logger", "[simple_logger]]")
TEST_CASE
(
"flush_on"
,
"[flush_on]]"
)
{
prepare_logdir
();
std
::
string
filename
=
"logs/simple_log.txt"
;
auto
logger
=
spdlog
::
create
<
spdlog
::
sinks
::
simple_file_sink_mt
>
(
"logger"
,
filename
);
logger
->
set_pattern
(
"%v"
);
logger
->
set_level
(
spdlog
::
level
::
trace
);
logger
->
flush_on
(
spdlog
::
level
::
info
);
logger
->
trace
(
"Should not be flushed"
);
REQUIRE
(
count_lines
(
filename
)
==
0
);
logger
->
info
(
"Test message {}"
,
1
);
logger
->
info
(
"Test message {}"
,
2
);
logger
->
flush
();
REQUIRE
(
file_contents
(
filename
)
==
std
::
string
(
"Should not be flushed
\n
Test message 1
\n
Test message 2
\n
"
));
REQUIRE
(
count_lines
(
filename
)
==
3
);
prepare_logdir
();
std
::
string
filename
=
"logs/simple_log.txt"
;
auto
logger
=
spdlog
::
create
<
spdlog
::
sinks
::
simple_file_sink_mt
>
(
"logger"
,
filename
);
logger
->
set_pattern
(
"%v"
);
logger
->
set_level
(
spdlog
::
level
::
trace
);
logger
->
flush_on
(
spdlog
::
level
::
info
);
logger
->
trace
(
"Should not be flushed"
);
REQUIRE
(
count_lines
(
filename
)
==
0
);
logger
->
info
(
"Test message {}"
,
1
);
logger
->
info
(
"Test message {}"
,
2
);
logger
->
flush
();
REQUIRE
(
file_contents
(
filename
)
==
std
::
string
(
"Should not be flushed
\n
Test message 1
\n
Test message 2
\n
"
));
REQUIRE
(
count_lines
(
filename
)
==
3
);
}
TEST_CASE
(
"rotating_file_logger1"
,
"[rotating_logger]]"
)
...
...
@@ -45,11 +45,11 @@ TEST_CASE("rotating_file_logger1", "[rotating_logger]]")
prepare_logdir
();
std
::
string
basename
=
"logs/rotating_log"
;
auto
logger
=
spdlog
::
rotating_logger_mt
(
"logger"
,
basename
,
1024
,
0
);
for
(
int
i
=
0
;
i
<
10
;
++
i
)
logger
->
info
(
"Test message {}"
,
i
);
logger
->
flush
();
logger
->
flush
();
auto
filename
=
basename
+
".txt"
;
REQUIRE
(
count_lines
(
filename
)
==
10
);
}
...
...
@@ -111,7 +111,7 @@ TEST_CASE("daily_logger with dateonly calculator", "[daily_logger_dateonly]]")
auto
logger
=
spdlog
::
create
<
sink_type
>
(
"logger"
,
basename
,
"txt"
,
0
,
0
);
for
(
int
i
=
0
;
i
<
10
;
++
i
)
logger
->
info
(
"Test message {}"
,
i
);
logger
->
flush
();
logger
->
flush
();
auto
filename
=
w
.
str
();
REQUIRE
(
count_lines
(
filename
)
==
10
);
}
...
...
@@ -144,8 +144,8 @@ TEST_CASE("daily_logger with custom calculator", "[daily_logger_custom]]")
for
(
int
i
=
0
;
i
<
10
;
++
i
)
logger
->
info
(
"Test message {}"
,
i
);
logger
->
flush
();
auto
filename
=
w
.
str
();
logger
->
flush
();
auto
filename
=
w
.
str
();
REQUIRE
(
count_lines
(
filename
)
==
10
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment