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
56ee7316
Commit
56ee7316
authored
Jan 27, 2015
by
gabi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed issue #39 User defined types no longer streamable
parent
d071e5fc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
8 deletions
+75
-8
line_logger.h
include/spdlog/details/line_logger.h
+75
-8
No files found.
include/spdlog/details/line_logger.h
View file @
56ee7316
...
...
@@ -23,7 +23,7 @@
/*************************************************************************/
#pragma once
#include <type_traits>
#include "../common.h"
#include "../logger.h"
#ifdef SPDLOG_CLOCK_COARSE
...
...
@@ -70,11 +70,11 @@ public:
#ifndef SPDLOG_CLOCK_COARSE
_log_msg
.
time
=
log_clock
::
now
();
#else
timespec
ts
;
::
clock_gettime
(
CLOCK_REALTIME_COARSE
,
&
ts
);
_log_msg
.
time
=
std
::
chrono
::
time_point
<
log_clock
,
typename
log_clock
::
duration
>
(
std
::
chrono
::
duration_cast
<
typename
log_clock
::
duration
>
(
std
::
chrono
::
seconds
(
ts
.
tv_sec
)
+
std
::
chrono
::
nanoseconds
(
ts
.
tv_nsec
)));
timespec
ts
;
::
clock_gettime
(
CLOCK_REALTIME_COARSE
,
&
ts
);
_log_msg
.
time
=
std
::
chrono
::
time_point
<
log_clock
,
typename
log_clock
::
duration
>
(
std
::
chrono
::
duration_cast
<
typename
log_clock
::
duration
>
(
std
::
chrono
::
seconds
(
ts
.
tv_sec
)
+
std
::
chrono
::
nanoseconds
(
ts
.
tv_nsec
)));
#endif
_callback_logger
->
_log_msg
(
_log_msg
);
}
...
...
@@ -96,18 +96,85 @@ public:
}
}
void
write
(
const
char
*
what
)
{
if
(
_enabled
)
_log_msg
.
raw
<<
what
;
}
void
write
(
const
std
::
string
&
what
)
{
if
(
_enabled
)
_log_msg
.
raw
<<
what
;
}
void
write
(
int
what
)
{
if
(
_enabled
)
_log_msg
.
raw
<<
what
;
}
void
write
(
unsigned
int
what
)
{
if
(
_enabled
)
_log_msg
.
raw
<<
what
;
}
void
write
(
long
what
)
{
if
(
_enabled
)
_log_msg
.
raw
<<
what
;
}
void
write
(
unsigned
long
what
)
{
if
(
_enabled
)
_log_msg
.
raw
<<
what
;
}
void
write
(
long
long
what
)
{
if
(
_enabled
)
_log_msg
.
raw
<<
what
;
}
void
write
(
unsigned
long
long
what
)
{
if
(
_enabled
)
_log_msg
.
raw
<<
what
;
}
void
write
(
double
what
)
{
if
(
_enabled
)
_log_msg
.
raw
<<
what
;
}
void
write
(
long
double
what
)
{
if
(
_enabled
)
_log_msg
.
raw
<<
what
;
}
void
write
(
float
what
)
{
if
(
_enabled
)
_log_msg
.
raw
<<
what
;
}
void
write
(
char
what
)
{
if
(
_enabled
)
_log_msg
.
raw
<<
what
;
}
template
<
typename
T
>
line_logger
&
operator
<<
(
const
T
&
what
)
{
if
(
_enabled
)
_log_msg
.
raw
<<
what
;
_log_msg
.
raw
.
write
(
"{}"
,
what
)
;
return
*
this
;
}
...
...
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