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
4696132c
Commit
4696132c
authored
Mar 30, 2014
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added trace log level
parent
36ef0732
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
3 deletions
+22
-3
example.cpp
example/example.cpp
+2
-1
common_types.h
include/c11log/common_types.h
+2
-1
logger.h
include/c11log/logger.h
+18
-1
No files found.
example/example.cpp
View file @
4696132c
...
...
@@ -21,8 +21,9 @@ int main(int argc, char* argv[])
const
unsigned
int
howmany
=
argc
<=
1
?
1000000
:
atoi
(
argv
[
1
]);
logger
cout_logger
(
""
,
sinks
::
stdout_sink
());
cout_logger
.
set_min_level
(
c11log
::
level
::
TRACE
);
cout_logger
.
info
()
<<
"Hello "
<<
"man"
<<
123
;
cout_logger
.
info
(
"This is very nice! "
)
<<
"Yes gabi.."
<<
":)"
;
cout_logger
.
trace
(
"This is very nice! "
)
<<
"Yes gabi.."
<<
":)"
;
auto
fsink
=
std
::
make_shared
<
sinks
::
rotating_file_sink
>
(
"log"
,
"txt"
,
1024
*
1024
*
50
,
5
,
0
);
auto
nullsink
=
sinks
::
null_sink
::
get
();
...
...
include/c11log/common_types.h
View file @
4696132c
...
...
@@ -12,6 +12,7 @@ namespace level
{
typedef
enum
{
TRACE
,
DEBUG
,
INFO
,
WARNING
,
...
...
@@ -21,7 +22,7 @@ typedef enum
NONE
=
99
}
level_enum
;
static
const
char
*
level_names
[]
{
"debug"
,
"info"
,
"warning"
,
"error"
,
"critical"
,
"fatal"
};
static
const
char
*
level_names
[]
{
"
trace"
,
"
debug"
,
"info"
,
"warning"
,
"error"
,
"critical"
,
"fatal"
};
inline
const
char
*
to_str
(
c11log
::
level
::
level_enum
l
)
{
return
level_names
[
l
];
...
...
include/c11log/logger.h
View file @
4696132c
...
...
@@ -49,7 +49,8 @@ public:
const
std
::
string
&
get_name
()
const
;
bool
should_log
(
c11log
::
level
::
level_enum
)
const
;
template
<
typename
T
>
details
::
line_logger
trace
(
const
T
&
);
template
<
typename
T
>
details
::
line_logger
debug
(
const
T
&
);
template
<
typename
T
>
details
::
line_logger
info
(
const
T
&
);
template
<
typename
T
>
details
::
line_logger
warn
(
const
T
&
);
...
...
@@ -57,6 +58,8 @@ public:
template
<
typename
T
>
details
::
line_logger
critical
(
const
T
&
);
template
<
typename
T
>
details
::
line_logger
fatal
(
const
T
&
);
details
::
line_logger
trace
();
details
::
line_logger
debug
();
details
::
line_logger
info
();
details
::
line_logger
warn
();
...
...
@@ -106,6 +109,14 @@ inline c11log::logger::logger(const std::string& name, sink_ptr sink, formatter_
template
<
typename
T
>
inline
c11log
::
details
::
line_logger
c11log
::
logger
::
trace
(
const
T
&
msg
)
{
details
::
line_logger
l
(
this
,
level
::
TRACE
,
should_log
(
level
::
TRACE
));
l
.
write
(
msg
);
return
l
;
}
template
<
typename
T
>
inline
c11log
::
details
::
line_logger
c11log
::
logger
::
debug
(
const
T
&
msg
)
{
...
...
@@ -146,6 +157,12 @@ inline c11log::details::line_logger c11log::logger::fatal(const T& msg)
return
l
;
}
inline
c11log
::
details
::
line_logger
c11log
::
logger
::
trace
()
{
return
details
::
line_logger
(
this
,
level
::
TRACE
,
should_log
(
level
::
TRACE
));
}
inline
c11log
::
details
::
line_logger
c11log
::
logger
::
debug
()
{
return
details
::
line_logger
(
this
,
level
::
DEBUG
,
should_log
(
level
::
DEBUG
));
...
...
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