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
57fe78f1
Commit
57fe78f1
authored
Mar 03, 2014
by
gabi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix code to support VS2013
parent
8b27eb0f
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
17 additions
and
13 deletions
+17
-13
example.cpp
example/example.cpp
+1
-1
blocking_queue.h
include/c11log/details/blocking_queue.h
+2
-4
fast_oss.h
include/c11log/details/fast_oss.h
+4
-1
os.h
include/c11log/details/os.h
+1
-2
formatter.h
include/c11log/formatter.h
+4
-2
logger.h
include/c11log/logger.h
+4
-2
async_sink.h
include/c11log/sinks/async_sink.h
+1
-1
No files found.
example/example.cpp
View file @
57fe78f1
...
...
@@ -48,7 +48,7 @@ void testlog(int threads)
int
main
(
int
argc
,
char
*
argv
[])
{
if
(
argc
||
argv
)
{};
if
(
argc
||
argv
)
{};
using
namespace
std
::
chrono
;
using
namespace
c11log
;
using
namespace
utils
;
...
...
include/c11log/details/blocking_queue.h
View file @
57fe78f1
...
...
@@ -58,8 +58,7 @@ public:
// If the queue is full, block the calling thread until there is room.
template
<
typename
TT
>
void
push
(
TT
&&
item
)
{
constexpr
std
::
chrono
::
hours
one_hour
(
1
);
while
(
!
push
(
std
::
forward
<
TT
>
(
item
),
one_hour
));
while
(
!
push
(
std
::
forward
<
TT
>
(
item
),
std
::
chrono
::
hours
(
1
)));
}
// Pop a copy of the front item in the queue into the given item ref.
...
...
@@ -86,8 +85,7 @@ public:
// Pop a copy of the front item in the queue into the given item ref.
// If the queue is empty, block the calling thread util there is item to pop.
void
pop
(
T
&
item
)
{
constexpr
std
::
chrono
::
hours
one_hour
(
1
);
while
(
!
pop
(
item
,
one_hour
));
while
(
!
pop
(
item
,
std
::
chrono
::
hours
(
1
)));
}
// Clear the queue
...
...
include/c11log/details/fast_oss.h
View file @
57fe78f1
...
...
@@ -18,6 +18,7 @@ public:
const
std
::
string
&
str_ref
()
const
{
return
_str
;
std
::
ostringstream
oss
;
}
void
clear
()
{
...
...
@@ -47,7 +48,9 @@ class fast_oss:public std::ostream {
public
:
fast_oss
()
:
std
::
ostream
(
&
_dev
)
{}
~
fast_oss
()
=
default
;
fast_oss
(
const
fast_oss
&
other
)
:
std
::
basic_ios
<
char
>
(),
std
::
ostream
(),
_dev
(
other
.
_dev
)
{}
fast_oss
(
const
fast_oss
&
other
)
:
std
::
ostream
(
&
_dev
),
_dev
(
other
.
_dev
)
{
}
fast_oss
&
operator
=
(
const
fast_oss
&
other
)
{
if
(
&
other
!=
this
)
_dev
=
other
.
_dev
;
...
...
include/c11log/details/os.h
View file @
57fe78f1
...
...
@@ -41,8 +41,7 @@ inline bool operator==(const std::tm& tm1, const std::tm& tm2)
tm1
.
tm_mday
==
tm2
.
tm_mday
&&
tm1
.
tm_mon
==
tm2
.
tm_mon
&&
tm1
.
tm_year
==
tm2
.
tm_year
&&
tm1
.
tm_isdst
==
tm2
.
tm_isdst
&&
tm1
.
tm_gmtoff
==
tm2
.
tm_gmtoff
);
tm1
.
tm_isdst
==
tm2
.
tm_isdst
);
}
inline
bool
operator
!=
(
const
std
::
tm
&
tm1
,
const
std
::
tm
&
tm2
)
...
...
include/c11log/formatter.h
View file @
57fe78f1
...
...
@@ -5,6 +5,7 @@
#include <functional>
#include <sstream>
#include <iomanip>
#include <thread>
#include "common_types.h"
#include "details/os.h"
...
...
@@ -43,8 +44,9 @@ private:
inline
void
c11log
::
formatters
::
default_formatter
::
_format_time
(
const
log_clock
::
time_point
&
tp
,
std
::
ostream
&
dest
)
{
static
thread_local
std
::
tm
last_tm
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
static
thread_local
char
last_time_str
[
64
];
__declspec
(
thread
)
static
std
::
tm
last_tm
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
__declspec
(
thread
)
static
char
last_time_str
[
64
];
auto
tm_now
=
details
::
os
::
localtime
(
log_clock
::
to_time_t
(
tp
));
if
(
last_tm
!=
tm_now
)
...
...
include/c11log/logger.h
View file @
57fe78f1
...
...
@@ -30,8 +30,10 @@ public:
_logger_name
(
name
),
_formatter
(
new
formatters
::
default_formatter
()),
_sinks
(),
_mutex
(),
_atomic_level
(
level
::
INFO
)
{
_mutex
()
{
//Seems that vs2013 doesnt support atomic member initialization in ctor, so its done here
_atomic_level
=
level
::
INFO
;
}
~
logger
()
=
default
;
...
...
include/c11log/sinks/async_sink.h
View file @
57fe78f1
...
...
@@ -61,7 +61,7 @@ inline void c11log::sinks::async_sink::_sink_it(const std::string& msg)
inline
void
c11log
::
sinks
::
async_sink
::
_thread_loop
()
{
constexpr
auto
pop_timeout
=
std
::
chrono
::
seconds
(
1
)
;
static
std
::
chrono
::
seconds
pop_timeout
{
1
}
;
std
::
string
msg
;
while
(
_active
)
{
...
...
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