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
4f65fcd7
Commit
4f65fcd7
authored
Jan 24, 2019
by
Philip Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove minor optimization for the sake of simplicity
parent
e41b92c5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
16 deletions
+6
-16
rotating_file_sink.h
include/spdlog/sinks/rotating_file_sink.h
+6
-16
No files found.
include/spdlog/sinks/rotating_file_sink.h
View file @
4f65fcd7
...
...
@@ -36,15 +36,12 @@ public:
,
max_size_
(
max_size
)
,
max_files_
(
max_files
)
{
if
(
rotate_on_open
)
{
rotate_
(
false
);
}
else
file_helper_
.
open
(
calc_filename
(
base_filename_
,
0
));
current_size_
=
file_helper_
.
size
();
// expensive. called only once
if
(
rotate_on_open
&&
current_size_
>
0
)
{
file_helper_
.
open
(
calc_filename
(
base_filename_
,
0
)
);
rotate_
(
);
}
current_size_
=
file_helper_
.
size
();
// expensive. called only once
}
// calc filename according to index and file extension if exists.
...
...
@@ -95,7 +92,7 @@ private:
// log.1.txt -> log.2.txt
// log.2.txt -> log.3.txt
// log.3.txt -> delete
void
rotate_
(
bool
reopen
=
true
)
void
rotate_
()
{
using
details
::
os
::
filename_to_str
;
file_helper_
.
close
();
...
...
@@ -123,14 +120,7 @@ private:
}
}
}
if
(
reopen
)
{
file_helper_
.
reopen
(
true
);
}
else
{
file_helper_
.
open
(
base_filename_
,
true
);
}
file_helper_
.
reopen
(
true
);
}
// delete the target if exists, and rename the src file to target
...
...
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