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
2ac214ae
Commit
2ac214ae
authored
Mar 02, 2014
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
snprinf for msc ver
parent
b396ff85
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
13 deletions
+18
-13
example.cpp
example/example.cpp
+4
-4
blocking_queue.h
include/c11log/details/blocking_queue.h
+2
-2
os.h
include/c11log/details/os.h
+5
-0
formatter.h
include/c11log/formatter.h
+1
-1
logger.h
include/c11log/logger.h
+6
-6
No files found.
example/example.cpp
View file @
2ac214ae
...
...
@@ -58,11 +58,11 @@ int main(int argc, char* argv[])
auto
&
logger2
=
c11log
::
get_logger
(
"logger2"
);
//logger2.add_sink(fsink2);
logger2
.
add_sink
(
std
::
make_shared
<
sinks
::
null_sink
>
());
logger2
.
add_sink
(
std
::
make_shared
<
sinks
::
stdout_sink
>
());
logger2
.
add_sink
(
std
::
make_shared
<
sinks
::
stdout_sink
>
());
info_logger
info
(
&
logger2
);
info
<<
"Hello info logger"
<<
"!!"
;
return
0
;
info_logger
info
(
&
logger2
);
info
<<
"Hello info logger"
<<
"!!"
;
return
0
;
auto
start
=
system_clock
::
now
();
const
unsigned
int
howmany
=
10000000
;
for
(
unsigned
int
i
=
0
;
i
<
howmany
;
i
++
)
...
...
include/c11log/details/blocking_queue.h
View file @
2ac214ae
...
...
@@ -58,7 +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
);
constexpr
std
::
chrono
::
hours
one_hour
(
1
);
while
(
!
push
(
std
::
forward
<
TT
>
(
item
),
one_hour
));
}
...
...
@@ -86,7 +86,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
);
constexpr
std
::
chrono
::
hours
one_hour
(
1
);
while
(
!
pop
(
item
,
one_hour
));
}
...
...
include/c11log/details/os.h
View file @
2ac214ae
...
...
@@ -31,3 +31,8 @@ inline std::tm c11log::details::os::localtime()
std
::
time_t
now_t
=
time
(
0
);
return
localtime
(
now_t
);
}
// Take care of snprintf in visual studio
#ifdef _MSC_VER
#define snprintf _snprintf
#endif
include/c11log/formatter.h
View file @
2ac214ae
...
...
@@ -42,7 +42,7 @@ private:
inline
void
c11log
::
formatters
::
default_formatter
::
_format_time
(
const
log_clock
::
time_point
&
tp
,
std
::
ostream
&
dest
)
{
{
auto
tm
=
details
::
os
::
localtime
(
log_clock
::
to_time_t
(
tp
));
char
buff
[
64
];
int
size
=
snprintf
(
buff
,
sizeof
(
buff
),
"[%d-%02d-%02d %02d:%02d:%02d]"
,
...
...
include/c11log/logger.h
View file @
2ac214ae
...
...
@@ -173,13 +173,13 @@ inline c11log::logger& c11log::get_logger(const std::string& name)
namespace
c11log
{
class
info_logger
{
public
:
info_logger
(
c11log
::
logger
*
logger
)
:
_logger
(
logger
)
{}
template
<
class
T
>
details
::
line_logger
&
operator
<<
(
const
T
&
msg
)
{
return
_logger
->
info
()
<<
msg
;
}
info_logger
(
c11log
::
logger
*
logger
)
:
_logger
(
logger
)
{}
template
<
class
T
>
details
::
line_logger
&
operator
<<
(
const
T
&
msg
)
{
return
_logger
->
info
()
<<
msg
;
}
private
:
c11log
::
logger
*
_logger
;
c11log
::
logger
*
_logger
;
};
}
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