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
5b273a33
Unverified
Commit
5b273a33
authored
6 years ago
by
Gabi Melman
Committed by
GitHub
6 years ago
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #955 from brridder/fix-typo
Fix typo in file_helper.h
parents
0203a0fd
fb702f98
v1.5.0
v1.4.2
v1.4.1
v1.4.0
v1.3.1
v1.3.0
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
5 deletions
+5
-5
file_helper.h
include/spdlog/details/file_helper.h
+1
-1
daily_file_sink.h
include/spdlog/sinks/daily_file_sink.h
+1
-1
rotating_file_sink.h
include/spdlog/sinks/rotating_file_sink.h
+1
-1
test_file_helper.cpp
tests/test_file_helper.cpp
+2
-2
No files found.
include/spdlog/details/file_helper.h
View file @
5b273a33
...
@@ -122,7 +122,7 @@ public:
...
@@ -122,7 +122,7 @@ public:
// ".mylog" => (".mylog". "")
// ".mylog" => (".mylog". "")
// "my_folder/.mylog" => ("my_folder/.mylog", "")
// "my_folder/.mylog" => ("my_folder/.mylog", "")
// "my_folder/.mylog.txt" => ("my_folder/.mylog", ".txt")
// "my_folder/.mylog.txt" => ("my_folder/.mylog", ".txt")
static
std
::
tuple
<
filename_t
,
filename_t
>
split_by_extens
t
ion
(
const
spdlog
::
filename_t
&
fname
)
static
std
::
tuple
<
filename_t
,
filename_t
>
split_by_extension
(
const
spdlog
::
filename_t
&
fname
)
{
{
auto
ext_index
=
fname
.
rfind
(
'.'
);
auto
ext_index
=
fname
.
rfind
(
'.'
);
...
...
This diff is collapsed.
Click to expand it.
include/spdlog/sinks/daily_file_sink.h
View file @
5b273a33
...
@@ -32,7 +32,7 @@ struct daily_filename_calculator
...
@@ -32,7 +32,7 @@ struct daily_filename_calculator
static
filename_t
calc_filename
(
const
filename_t
&
filename
,
const
tm
&
now_tm
)
static
filename_t
calc_filename
(
const
filename_t
&
filename
,
const
tm
&
now_tm
)
{
{
filename_t
basename
,
ext
;
filename_t
basename
,
ext
;
std
::
tie
(
basename
,
ext
)
=
details
::
file_helper
::
split_by_extens
t
ion
(
filename
);
std
::
tie
(
basename
,
ext
)
=
details
::
file_helper
::
split_by_extension
(
filename
);
std
::
conditional
<
std
::
is_same
<
filename_t
::
value_type
,
char
>::
value
,
fmt
::
memory_buffer
,
fmt
::
wmemory_buffer
>::
type
w
;
std
::
conditional
<
std
::
is_same
<
filename_t
::
value_type
,
char
>::
value
,
fmt
::
memory_buffer
,
fmt
::
wmemory_buffer
>::
type
w
;
fmt
::
format_to
(
fmt
::
format_to
(
w
,
SPDLOG_FILENAME_T
(
"{}_{:04d}-{:02d}-{:02d}{}"
),
basename
,
now_tm
.
tm_year
+
1900
,
now_tm
.
tm_mon
+
1
,
now_tm
.
tm_mday
,
ext
);
w
,
SPDLOG_FILENAME_T
(
"{}_{:04d}-{:02d}-{:02d}{}"
),
basename
,
now_tm
.
tm_year
+
1900
,
now_tm
.
tm_mon
+
1
,
now_tm
.
tm_mday
,
ext
);
...
...
This diff is collapsed.
Click to expand it.
include/spdlog/sinks/rotating_file_sink.h
View file @
5b273a33
...
@@ -48,7 +48,7 @@ public:
...
@@ -48,7 +48,7 @@ public:
if
(
index
!=
0u
)
if
(
index
!=
0u
)
{
{
filename_t
basename
,
ext
;
filename_t
basename
,
ext
;
std
::
tie
(
basename
,
ext
)
=
details
::
file_helper
::
split_by_extens
t
ion
(
filename
);
std
::
tie
(
basename
,
ext
)
=
details
::
file_helper
::
split_by_extension
(
filename
);
fmt
::
format_to
(
w
,
SPDLOG_FILENAME_T
(
"{}.{}{}"
),
basename
,
index
,
ext
);
fmt
::
format_to
(
w
,
SPDLOG_FILENAME_T
(
"{}.{}{}"
),
basename
,
index
,
ext
);
}
}
else
else
...
...
This diff is collapsed.
Click to expand it.
tests/test_file_helper.cpp
View file @
5b273a33
...
@@ -81,12 +81,12 @@ static void test_split_ext(const char *fname, const char *expect_base, const cha
...
@@ -81,12 +81,12 @@ static void test_split_ext(const char *fname, const char *expect_base, const cha
std
::
replace
(
expected_base
.
begin
(),
expected_base
.
end
(),
'/'
,
'\\'
);
std
::
replace
(
expected_base
.
begin
(),
expected_base
.
end
(),
'/'
,
'\\'
);
#endif
#endif
spdlog
::
filename_t
basename
,
ext
;
spdlog
::
filename_t
basename
,
ext
;
std
::
tie
(
basename
,
ext
)
=
file_helper
::
split_by_extens
t
ion
(
filename
);
std
::
tie
(
basename
,
ext
)
=
file_helper
::
split_by_extension
(
filename
);
REQUIRE
(
basename
==
expected_base
);
REQUIRE
(
basename
==
expected_base
);
REQUIRE
(
ext
==
expected_ext
);
REQUIRE
(
ext
==
expected_ext
);
}
}
TEST_CASE
(
"file_helper_split_by_extens
tion"
,
"[file_helper::split_by_extenst
ion()]]"
)
TEST_CASE
(
"file_helper_split_by_extens
ion"
,
"[file_helper::split_by_extens
ion()]]"
)
{
{
test_split_ext
(
"mylog.txt"
,
"mylog"
,
".txt"
);
test_split_ext
(
"mylog.txt"
,
"mylog"
,
".txt"
);
test_split_ext
(
".mylog.txt"
,
".mylog"
,
".txt"
);
test_split_ext
(
".mylog.txt"
,
".mylog"
,
".txt"
);
...
...
This diff is collapsed.
Click to expand it.
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