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
17caf777
Commit
17caf777
authored
Feb 25, 2018
by
Daniel Chabrowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
google-build-namespaces
parent
0c94ce00
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
17 deletions
+4
-17
include/spdlog/details/os.h
include/spdlog/details/os.h
+2
-2
include/spdlog/details/pattern_formatter_impl.h
include/spdlog/details/pattern_formatter_impl.h
+0
-4
tests/file_helper.cpp
tests/file_helper.cpp
+2
-11
No files found.
include/spdlog/details/os.h
View file @
17caf777
...
@@ -317,9 +317,9 @@ inline int utc_minutes_offset(const std::tm& tm = details::os::localtime())
...
@@ -317,9 +317,9 @@ inline int utc_minutes_offset(const std::tm& tm = details::os::localtime())
}
}
};
};
long
int
offset_seconds
=
helper
::
calculate_gmt_offset
(
tm
);
auto
offset_seconds
=
helper
::
calculate_gmt_offset
(
tm
);
#else
#else
long
int
offset_seconds
=
tm
.
tm_gmtoff
;
auto
offset_seconds
=
tm
.
tm_gmtoff
;
#endif
#endif
return
static_cast
<
int
>
(
offset_seconds
/
60
);
return
static_cast
<
int
>
(
offset_seconds
/
60
);
...
...
include/spdlog/details/pattern_formatter_impl.h
View file @
17caf777
...
@@ -34,8 +34,6 @@ public:
...
@@ -34,8 +34,6 @@ public:
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// name & level pattern appenders
// name & level pattern appenders
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
namespace
{
class
name_formatter
:
public
flag_formatter
class
name_formatter
:
public
flag_formatter
{
{
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
)
override
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
)
override
...
@@ -43,7 +41,6 @@ class name_formatter : public flag_formatter
...
@@ -43,7 +41,6 @@ class name_formatter : public flag_formatter
msg
.
formatted
<<
*
msg
.
logger_name
;
msg
.
formatted
<<
*
msg
.
logger_name
;
}
}
};
};
}
// log level appender
// log level appender
class
level_formatter
:
public
flag_formatter
class
level_formatter
:
public
flag_formatter
...
@@ -344,7 +341,6 @@ private:
...
@@ -344,7 +341,6 @@ private:
int
get_cached_offset
(
const
log_msg
&
msg
,
const
std
::
tm
&
tm_time
)
int
get_cached_offset
(
const
log_msg
&
msg
,
const
std
::
tm
&
tm_time
)
{
{
using
namespace
std
::
chrono
;
std
::
lock_guard
<
std
::
mutex
>
l
(
_mutex
);
std
::
lock_guard
<
std
::
mutex
>
l
(
_mutex
);
if
(
msg
.
time
-
_last_update
>=
cache_refresh
)
if
(
msg
.
time
-
_last_update
>=
cache_refresh
)
{
{
...
...
tests/file_helper.cpp
View file @
17caf777
...
@@ -3,7 +3,8 @@
...
@@ -3,7 +3,8 @@
*/
*/
#include "includes.h"
#include "includes.h"
using
namespace
spdlog
::
details
;
using
spdlog
::
details
::
log_msg
;
using
spdlog
::
details
::
file_helper
;
static
const
std
::
string
target_filename
=
"logs/file_helper_test.txt"
;
static
const
std
::
string
target_filename
=
"logs/file_helper_test.txt"
;
...
@@ -15,7 +16,6 @@ static void write_with_helper(file_helper &helper, size_t howmany)
...
@@ -15,7 +16,6 @@ static void write_with_helper(file_helper &helper, size_t howmany)
helper
.
flush
();
helper
.
flush
();
}
}
TEST_CASE
(
"file_helper_filename"
,
"[file_helper::filename()]]"
)
TEST_CASE
(
"file_helper_filename"
,
"[file_helper::filename()]]"
)
{
{
prepare_logdir
();
prepare_logdir
();
...
@@ -25,8 +25,6 @@ TEST_CASE("file_helper_filename", "[file_helper::filename()]]")
...
@@ -25,8 +25,6 @@ TEST_CASE("file_helper_filename", "[file_helper::filename()]]")
REQUIRE
(
helper
.
filename
()
==
target_filename
);
REQUIRE
(
helper
.
filename
()
==
target_filename
);
}
}
TEST_CASE
(
"file_helper_size"
,
"[file_helper::size()]]"
)
TEST_CASE
(
"file_helper_size"
,
"[file_helper::size()]]"
)
{
{
prepare_logdir
();
prepare_logdir
();
...
@@ -40,7 +38,6 @@ TEST_CASE("file_helper_size", "[file_helper::size()]]")
...
@@ -40,7 +38,6 @@ TEST_CASE("file_helper_size", "[file_helper::size()]]")
REQUIRE
(
get_filesize
(
target_filename
)
==
expected_size
);
REQUIRE
(
get_filesize
(
target_filename
)
==
expected_size
);
}
}
TEST_CASE
(
"file_helper_exists"
,
"[file_helper::file_exists()]]"
)
TEST_CASE
(
"file_helper_exists"
,
"[file_helper::file_exists()]]"
)
{
{
prepare_logdir
();
prepare_logdir
();
...
@@ -73,8 +70,6 @@ TEST_CASE("file_helper_reopen2", "[file_helper::reopen(false)]]")
...
@@ -73,8 +70,6 @@ TEST_CASE("file_helper_reopen2", "[file_helper::reopen(false)]]")
REQUIRE
(
helper
.
size
()
==
expected_size
);
REQUIRE
(
helper
.
size
()
==
expected_size
);
}
}
static
void
test_split_ext
(
const
char
*
fname
,
const
char
*
expect_base
,
const
char
*
expect_ext
)
static
void
test_split_ext
(
const
char
*
fname
,
const
char
*
expect_base
,
const
char
*
expect_ext
)
{
{
spdlog
::
filename_t
filename
(
fname
);
spdlog
::
filename_t
filename
(
fname
);
...
@@ -91,7 +86,6 @@ static void test_split_ext(const char* fname, const char* expect_base, const cha
...
@@ -91,7 +86,6 @@ static void test_split_ext(const char* fname, const char* expect_base, const cha
REQUIRE
(
ext
==
expected_ext
);
REQUIRE
(
ext
==
expected_ext
);
}
}
TEST_CASE
(
"file_helper_split_by_extenstion"
,
"[file_helper::split_by_extenstion()]]"
)
TEST_CASE
(
"file_helper_split_by_extenstion"
,
"[file_helper::split_by_extenstion()]]"
)
{
{
test_split_ext
(
"mylog.txt"
,
"mylog"
,
".txt"
);
test_split_ext
(
"mylog.txt"
,
"mylog"
,
".txt"
);
...
@@ -113,6 +107,3 @@ TEST_CASE("file_helper_split_by_extenstion", "[file_helper::split_by_extenstion(
...
@@ -113,6 +107,3 @@ TEST_CASE("file_helper_split_by_extenstion", "[file_helper::split_by_extenstion(
test_split_ext
(
"."
,
"."
,
""
);
test_split_ext
(
"."
,
"."
,
""
);
test_split_ext
(
"..txt"
,
"."
,
".txt"
);
test_split_ext
(
"..txt"
,
"."
,
".txt"
);
}
}
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