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
f090d660
Commit
f090d660
authored
Mar 29, 2014
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
astyle
parent
87cc555d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
27 deletions
+27
-27
example/example.cpp
example/example.cpp
+2
-2
include/c11log/details/line_logger.h
include/c11log/details/line_logger.h
+2
-2
include/c11log/logger.h
include/c11log/logger.h
+18
-18
include/c11log/sinks/base_sink.h
include/c11log/sinks/base_sink.h
+5
-5
No files found.
example/example.cpp
View file @
f090d660
...
...
@@ -20,8 +20,8 @@ int main(int argc, char* argv[])
const
unsigned
int
howmany
=
argc
<=
1
?
1000
:
atoi
(
argv
[
1
]);
logger
cout_logger
(
""
,
sinks
::
stdout_sink
());
cout_logger
.
info
(
"Hello "
)
<<
"man"
;
logger
cout_logger
(
""
,
sinks
::
stdout_sink
());
cout_logger
.
info
(
"Hello "
)
<<
"man"
;
auto
fsink
=
std
::
make_shared
<
sinks
::
rotating_file_sink
>
(
"log"
,
"txt"
,
1024
*
1024
*
50
,
5
,
0
);
...
...
include/c11log/details/line_logger.h
View file @
f090d660
...
...
@@ -25,7 +25,7 @@ public:
{
if
(
enabled
)
{
_log_msg
.
msg_time
=
log_clock
::
now
();
_log_msg
.
msg_time
=
log_clock
::
now
();
callback_logger
->
_formatter
->
format_header
(
callback_logger
->
_logger_name
,
_log_msg
.
msg_level
,
_log_msg
.
msg_time
,
...
...
@@ -56,7 +56,7 @@ public:
_callback_logger
->
_log_it
(
_log_msg
);
}
}
template
<
typename
T
>
line_logger
&
operator
<<
(
const
T
&
what
)
{
...
...
include/c11log/logger.h
View file @
f090d660
...
...
@@ -35,7 +35,7 @@ public:
using
sinks_init_list
=
std
::
initializer_list
<
sink_ptr
>
;
logger
(
const
std
::
string
&
name
,
sinks_init_list
,
formatter_ptr
=
nullptr
);
logger
(
const
std
::
string
&
name
,
sink_ptr
,
formatter_ptr
=
nullptr
);
logger
(
const
std
::
string
&
name
,
sink_ptr
,
formatter_ptr
=
nullptr
);
~
logger
()
=
default
;
...
...
@@ -56,7 +56,7 @@ public:
template
<
typename
T
>
details
::
line_logger
info
(
const
T
&
);
template
<
typename
T
>
details
::
line_logger
warn
(
const
T
&
);
template
<
typename
T
>
details
::
line_logger
error
(
const
T
&
);
template
<
typename
T
>
details
::
line_logger
critical
(
const
T
&
);
template
<
typename
T
>
details
::
line_logger
critical
(
const
T
&
);
template
<
typename
T
>
details
::
line_logger
fatal
(
const
T
&
);
...
...
@@ -89,13 +89,13 @@ inline c11log::logger::logger(const std::string& name, sinks_init_list sinks_lis
{
//Seems that vs2013 doesnt support std::atomic member initialization, so its done here
_logger_level
=
level
::
INFO
;
if
(
!
_formatter
)
_formatter
=
std
::
make_shared
<
formatters
::
default_formatter
>
();
if
(
!
_formatter
)
_formatter
=
std
::
make_shared
<
formatters
::
default_formatter
>
();
}
inline
c11log
::
logger
::
logger
(
const
std
::
string
&
name
,
sink_ptr
sink
,
formatter_ptr
f
)
:
logger
(
name
,
{
sink
},
f
)
{}
logger
(
name
,
{
sink
},
f
)
{}
inline
c11log
::
details
::
line_logger
c11log
::
logger
::
log
(
c11log
::
level
::
level_enum
msg_level
)
{
...
...
@@ -108,8 +108,8 @@ inline c11log::details::line_logger c11log::logger::debug(const T& what)
{
bool
really_log
=
should_log
(
level
::
DEBUG
);
details
::
line_logger
l
(
this
,
level
::
DEBUG
,
really_log
);
if
(
really_log
)
l
<<
what
;
if
(
really_log
)
l
<<
what
;
return
l
;
}
...
...
@@ -118,8 +118,8 @@ inline c11log::details::line_logger c11log::logger::info(const T& what)
{
bool
really_log
=
should_log
(
level
::
INFO
);
details
::
line_logger
l
(
this
,
level
::
INFO
,
really_log
);
if
(
really_log
)
l
<<
what
;
if
(
really_log
)
l
<<
what
;
return
l
;
}
...
...
@@ -129,8 +129,8 @@ inline c11log::details::line_logger c11log::logger::warn(const T& what)
{
bool
really_log
=
should_log
(
level
::
WARNING
);
details
::
line_logger
l
(
this
,
level
::
WARNING
,
really_log
);
if
(
really_log
)
l
<<
what
;
if
(
really_log
)
l
<<
what
;
return
l
;
}
...
...
@@ -140,8 +140,8 @@ inline c11log::details::line_logger c11log::logger::error(const T& what)
{
bool
really_log
=
should_log
(
level
::
ERROR
);
details
::
line_logger
l
(
this
,
level
::
ERROR
,
really_log
);
if
(
really_log
)
l
<<
what
;
if
(
really_log
)
l
<<
what
;
return
l
;
}
...
...
@@ -151,18 +151,18 @@ inline c11log::details::line_logger c11log::logger::critical(const T& what)
{
bool
really_log
=
should_log
(
level
::
CRITICAL
);
details
::
line_logger
l
(
this
,
level
::
CRITICAL
,
really_log
);
if
(
really_log
)
l
<<
what
;
if
(
really_log
)
l
<<
what
;
return
l
;
}
template
<
typename
T
>
inline
c11log
::
details
::
line_logger
c11log
::
logger
::
fatal
(
const
T
&
what
)
{
bool
really_log
=
should_log
(
level
::
FATAL
);
bool
really_log
=
should_log
(
level
::
FATAL
);
details
::
line_logger
l
(
this
,
level
::
FATAL
,
really_log
);
if
(
really_log
)
l
<<
what
;
if
(
really_log
)
l
<<
what
;
return
l
;
}
...
...
include/c11log/sinks/base_sink.h
View file @
f090d660
...
...
@@ -46,11 +46,11 @@ protected:
class
null_sink
:
public
base_sink
{
public:
static
std
::
shared_ptr
<
null_sink
>&
get
()
{
static
auto
inst
=
std
::
make_shared
<
null_sink
>
();
return
inst
;
}
static
std
::
shared_ptr
<
null_sink
>&
get
()
{
static
auto
inst
=
std
::
make_shared
<
null_sink
>
();
return
inst
;
}
protected:
void
_sink_it
(
const
details
::
log_msg
&
)
override
{}
...
...
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