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
0ed3e4cf
Commit
0ed3e4cf
authored
Dec 22, 2017
by
gabime
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/gabime/spdlog
parents
6d355fd6
dd0b7b2d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
10 deletions
+25
-10
CMakeLists.txt
CMakeLists.txt
+1
-1
include/spdlog/details/file_helper.h
include/spdlog/details/file_helper.h
+8
-7
include/spdlog/spdlog.h
include/spdlog/spdlog.h
+1
-1
tests/errors.cpp
tests/errors.cpp
+1
-1
tests/file_helper.cpp
tests/file_helper.cpp
+14
-0
No files found.
CMakeLists.txt
View file @
0ed3e4cf
...
...
@@ -4,7 +4,7 @@
#
cmake_minimum_required
(
VERSION 3.1
)
project
(
spdlog VERSION 0.1
4.0
)
project
(
spdlog VERSION 0.1
6.1
)
include
(
CTest
)
include
(
CMakeDependentOption
)
include
(
GNUInstallDirs
)
...
...
include/spdlog/details/file_helper.h
View file @
0ed3e4cf
...
...
@@ -118,17 +118,18 @@ public:
//
// "my_folder/.mylog" => ("my_folder/.mylog")
// "my_folder/.mylog.txt" => ("my_folder/.mylog", ".txt")
static
std
::
tuple
<
filename_t
,
filename_t
>
split_by_extenstion
(
const
filename_t
&
fname
)
{
auto
index
=
fname
.
rfind
(
'.'
);
bool
found_ext
=
index
!=
filename_t
::
npos
&&
index
!=
0
&&
fname
[
index
-
1
]
!=
details
::
os
::
folder_sep
;
if
(
found_ext
)
return
std
::
make_tuple
(
fname
.
substr
(
0
,
index
),
fname
.
substr
(
index
));
else
return
std
::
make_tuple
(
fname
,
filename_t
());
if
(
index
!=
filename_t
::
npos
&&
index
!=
fname
.
size
()
-
1
&&
index
!=
0
&&
fname
[
index
-
1
]
!=
details
::
os
::
folder_sep
)
{
auto
index2
=
fname
.
find
(
details
::
os
::
folder_sep
,
index
);
if
(
index2
==
fname
.
npos
)
{
return
std
::
make_tuple
(
fname
.
substr
(
0
,
index
),
fname
.
substr
(
index
));
}
}
return
std
::
make_tuple
(
fname
,
std
::
string
());
}
private:
FILE
*
_fd
;
filename_t
_filename
;
...
...
include/spdlog/spdlog.h
View file @
0ed3e4cf
...
...
@@ -7,7 +7,7 @@
#pragma once
#define SPDLOG_VERSION "0.1
4.0
"
#define SPDLOG_VERSION "0.1
6.1
"
#include "tweakme.h"
#include "common.h"
...
...
tests/errors.cpp
View file @
0ed3e4cf
...
...
@@ -15,7 +15,7 @@ class failing_sink: public spdlog::sinks::sink
throw
std
::
runtime_error
(
"some error happened during log"
);
}
void
flush
()
void
flush
()
override
{}
};
...
...
tests/file_helper.cpp
View file @
0ed3e4cf
...
...
@@ -145,5 +145,19 @@ TEST_CASE("file_helper_split_by_extenstion7", "[file_helper::split_by_extenstion
}
TEST_CASE
(
"file_helper_split_by_extenstion8"
,
"[file_helper::split_by_extenstion(hidden_file)]]"
)
{
#ifdef _WIN32
auto
filename
=
"folder.ext
\\
mylog"
;
auto
expected_basename
=
"folder.ext
\\
mylog"
;
#else
auto
filename
=
"folder.ext/mylog"
;
auto
expected_basename
=
"folder.ext/mylog"
;
#endif
std
::
string
basename
,
ext
;
std
::
tie
(
basename
,
ext
)
=
file_helper
::
split_by_extenstion
(
filename
);
REQUIRE
(
basename
==
expected_basename
);
REQUIRE
(
ext
==
""
);
}
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