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
94deae04
Commit
94deae04
authored
Jan 28, 2015
by
Gabi Melman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better support for operator<<
parent
56ee7316
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
16 deletions
+41
-16
include/spdlog/details/line_logger.h
include/spdlog/details/line_logger.h
+41
-16
No files found.
include/spdlog/details/line_logger.h
View file @
94deae04
...
@@ -80,6 +80,16 @@ public:
...
@@ -80,6 +80,16 @@ public:
}
}
}
}
//
// Support for format string with variadic args
//
void
write
(
const
char
*
what
)
{
if
(
_enabled
)
_log_msg
.
raw
<<
what
;
}
template
<
typename
...
Args
>
template
<
typename
...
Args
>
void
write
(
const
char
*
fmt
,
const
Args
&
...
args
)
void
write
(
const
char
*
fmt
,
const
Args
&
...
args
)
...
@@ -96,80 +106,96 @@ public:
...
@@ -96,80 +106,96 @@ public:
}
}
}
}
void
write
(
const
char
*
what
)
//
// Support for operator<<
//
line_logger
&
operator
<<
(
const
char
*
what
)
{
{
if
(
_enabled
)
if
(
_enabled
)
_log_msg
.
raw
<<
what
;
_log_msg
.
raw
<<
what
;
return
*
this
;
}
}
void
write
(
const
std
::
string
&
what
)
line_logger
&
operator
<<
(
const
std
::
string
&
what
)
{
{
if
(
_enabled
)
if
(
_enabled
)
_log_msg
.
raw
<<
what
;
_log_msg
.
raw
<<
what
;
return
*
this
;
}
}
void
write
(
int
what
)
line_logger
&
operator
<<
(
int
what
)
{
{
if
(
_enabled
)
if
(
_enabled
)
_log_msg
.
raw
<<
what
;
_log_msg
.
raw
<<
what
;
return
*
this
;
}
}
void
write
(
unsigned
int
what
)
line_logger
&
operator
<<
(
unsigned
int
what
)
{
{
if
(
_enabled
)
if
(
_enabled
)
_log_msg
.
raw
<<
what
;
_log_msg
.
raw
<<
what
;
return
*
this
;
}
}
void
write
(
long
what
)
line_logger
&
operator
<<
(
long
what
)
{
{
if
(
_enabled
)
if
(
_enabled
)
_log_msg
.
raw
<<
what
;
_log_msg
.
raw
<<
what
;
return
*
this
;
}
}
void
write
(
unsigned
long
what
)
line_logger
&
operator
<<
(
unsigned
long
what
)
{
{
if
(
_enabled
)
if
(
_enabled
)
_log_msg
.
raw
<<
what
;
_log_msg
.
raw
<<
what
;
return
*
this
;
}
}
void
write
(
long
long
what
)
line_logger
&
operator
<<
(
long
long
what
)
{
{
if
(
_enabled
)
if
(
_enabled
)
_log_msg
.
raw
<<
what
;
_log_msg
.
raw
<<
what
;
return
*
this
;
}
}
void
write
(
unsigned
long
long
what
)
line_logger
&
operator
<<
(
unsigned
long
long
what
)
{
{
if
(
_enabled
)
if
(
_enabled
)
_log_msg
.
raw
<<
what
;
_log_msg
.
raw
<<
what
;
return
*
this
;
}
}
void
write
(
double
what
)
line_logger
&
operator
<<
(
double
what
)
{
{
if
(
_enabled
)
if
(
_enabled
)
_log_msg
.
raw
<<
what
;
_log_msg
.
raw
<<
what
;
return
*
this
;
}
}
void
write
(
long
double
what
)
line_logger
&
operator
<<
(
long
double
what
)
{
{
if
(
_enabled
)
if
(
_enabled
)
_log_msg
.
raw
<<
what
;
_log_msg
.
raw
<<
what
;
return
*
this
;
}
}
void
write
(
float
what
)
line_logger
&
operator
<<
(
float
what
)
{
{
if
(
_enabled
)
if
(
_enabled
)
_log_msg
.
raw
<<
what
;
_log_msg
.
raw
<<
what
;
return
*
this
;
}
}
void
write
(
char
what
)
line_logger
&
operator
<<
(
char
what
)
{
{
if
(
_enabled
)
if
(
_enabled
)
_log_msg
.
raw
<<
what
;
_log_msg
.
raw
<<
what
;
return
*
this
;
}
}
//Support user types which implements operator<<
template
<
typename
T
>
template
<
typename
T
>
line_logger
&
operator
<<
(
const
T
&
what
)
line_logger
&
operator
<<
(
const
T
&
what
)
{
{
...
@@ -178,14 +204,13 @@ public:
...
@@ -178,14 +204,13 @@ public:
return
*
this
;
return
*
this
;
}
}
void
disable
()
void
disable
()
{
{
_enabled
=
false
;
_enabled
=
false
;
}
}
private:
private:
logger
*
_callback_logger
;
logger
*
_callback_logger
;
log_msg
_log_msg
;
log_msg
_log_msg
;
...
...
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