Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
S
spdlog
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
spdlog
Commits
dcdf2280
Commit
dcdf2280
authored
May 15, 2015
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed tests
parent
8387d779
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
file_log.cpp
tests/file_log.cpp
+8
-8
No files found.
tests/file_log.cpp
View file @
dcdf2280
...
...
@@ -32,13 +32,13 @@ std::ifstream::pos_type filesize(const std::string& filename)
return
ifs
.
tellg
();
}
static
void
delete_logs
()
static
void
prepare_logdir
()
{
spdlog
::
drop_all
();
#ifdef _WIN32
auto
rv
=
system
(
"del /F /Q logs
\\
*"
);
auto
rv
=
system
(
"
mkdir logs;
del /F /Q logs
\\
*"
);
#else
auto
rv
=
system
(
"rm -f logs/*"
);
auto
rv
=
system
(
"
mkdir logs;
rm -f logs/*"
);
#endif
}
...
...
@@ -46,7 +46,7 @@ static void delete_logs()
TEST_CASE
(
"simple_file_logger"
,
"[simple_logger]]"
)
{
delete_logs
();
prepare_logdir
();
std
::
string
filename
=
"logs/simple_log.txt"
;
auto
logger
=
spdlog
::
create
<
spdlog
::
sinks
::
simple_file_sink_mt
>
(
"logger"
,
filename
);
...
...
@@ -64,7 +64,7 @@ TEST_CASE("simple_file_logger", "[simple_logger]]")
TEST_CASE
(
"rotating_file_logger1"
,
"[rotating_logger]]"
)
{
delete_logs
();
prepare_logdir
();
std
::
string
basename
=
"logs/rotating_log"
;
auto
logger
=
spdlog
::
rotating_logger_mt
(
"logger"
,
basename
,
1024
,
0
,
true
);
for
(
int
i
=
0
;
i
<
10
;
++
i
)
...
...
@@ -80,7 +80,7 @@ TEST_CASE("rotating_file_logger1", "[rotating_logger]]")
TEST_CASE
(
"rotating_file_logger2"
,
"[rotating_logger]]"
)
{
delete_logs
();
prepare_logdir
();
std
::
string
basename
=
"logs/rotating_log"
;
auto
logger
=
spdlog
::
rotating_logger_mt
(
"logger"
,
basename
,
1024
,
1
,
false
);
for
(
int
i
=
0
;
i
<
10
;
++
i
)
...
...
@@ -102,8 +102,8 @@ TEST_CASE("rotating_file_logger2", "[rotating_logger]]")
TEST_CASE
(
"daily_logger"
,
"[daily_logger]]"
)
{
delete_logs
();
//calculate filename (time based)
prepare_logdir
();
//calculate filename (time based)
std
::
string
basename
=
"logs/daily_log"
;
std
::
tm
tm
=
spdlog
::
details
::
os
::
localtime
();
fmt
::
MemoryWriter
w
;
...
...
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