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
0be89810
Commit
0be89810
authored
Oct 14, 2014
by
gabi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
logger class cleanup
parent
c573d2b7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
71 deletions
+26
-71
c11logtest.vcxproj.filters
c11logtest/c11logtest/c11logtest.vcxproj.filters
+3
-3
bench.cpp
example/bench.cpp
+2
-2
logger.h
include/c11log/logger.h
+21
-66
No files found.
c11logtest/c11logtest/c11logtest.vcxproj.filters
View file @
0be89810
...
...
@@ -90,12 +90,12 @@
<ClInclude
Include=
"..\..\include\c11log\factory.h"
>
<Filter>
Header Files\c11log
</Filter>
</ClInclude>
<ClInclude
Include=
"..\..\include\c11log\pattern_formatter.h"
>
<Filter>
Header Files\c11log\sinks
</Filter>
</ClInclude>
<ClInclude
Include=
"..\..\include\c11log\details\fast_istostr.h"
>
<Filter>
Header Files\c11log\details
</Filter>
</ClInclude>
<ClInclude
Include=
"..\..\include\c11log\pattern_formatter.h"
>
<Filter>
Header Files\c11log
</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile
Include=
"stdafx.cpp"
>
...
...
example/bench.cpp
View file @
0be89810
...
...
@@ -21,7 +21,7 @@ int main(int argc, char* argv[])
const
unsigned
int
howmany
=
argc
<=
1
?
500000
:
atoi
(
argv
[
1
]);
std
::
string
pattern
=
"%Y:%m:%d %H:%M:%S.%e [%n:%l] %t"
;
auto
formatter1
=
std
::
unique_ptr
<
formatter
s
::
formatter
>
(
new
formatters
::
pattern_formatter
(
pattern
));
auto
formatter1
=
std
::
unique_ptr
<
formatter
>
(
new
pattern_formatter
(
pattern
));
logger
cout_logger
(
"bench"
,
std
::
make_shared
<
sinks
::
stderr_sink_mt
>
()
,
std
::
move
(
formatter1
));
cout_logger
.
info
()
<<
"Hello logger"
;
...
...
@@ -29,7 +29,7 @@ int main(int argc, char* argv[])
auto
nullsink
=
std
::
make_shared
<
sinks
::
null_sink
<
details
::
null_mutex
>>
();
auto
formatter2
=
std
::
unique_ptr
<
formatter
s
::
formatter
>
(
new
formatters
::
pattern_formatter
(
pattern
));
auto
formatter2
=
std
::
unique_ptr
<
formatter
>
(
new
pattern_formatter
(
pattern
));
logger
my_logger
(
"my_logger"
,
nullsink
,
std
::
move
(
formatter2
));
//logger my_logger("my_logger", nullsink);
...
...
include/c11log/logger.h
View file @
0be89810
...
...
@@ -47,22 +47,14 @@ public:
const
std
::
string
&
name
()
const
;
bool
should_log
(
level
::
level_enum
)
const
;
template
<
typename
...
Args
>
details
::
line_logger
log
(
level
::
level_enum
lvl
,
const
Args
&
...
args
);
template
<
typename
T
>
details
::
line_logger
trace
(
const
T
&
);
template
<
typename
T
>
details
::
line_logger
debug
(
const
T
&
);
template
<
typename
...
Args
>
details
::
line_logger
log
(
level
::
level_enum
lvl
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
trace
(
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
debug
(
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
info
(
const
Args
&
...
args
);
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
&
);
details
::
line_logger
trace
();
details
::
line_logger
debug
();
details
::
line_logger
warn
();
details
::
line_logger
&
error
();
details
::
line_logger
critical
();
template
<
typename
...
Args
>
details
::
line_logger
warn
(
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
error
(
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
critical
(
const
Args
&
...
args
);
...
...
@@ -126,27 +118,10 @@ inline c11log::logger::logger(const std::string& name, It begin, It end, formatt
}
inline
c11log
::
logger
::
logger
(
const
std
::
string
&
name
,
sink_ptr
sink
,
formatter_ptr
f
)
:
logger
(
name
,
{
sink
},
std
::
move
(
f
))
{}
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
)
{
c11log
::
details
::
line_logger
l
(
this
,
level
::
DEBUG
,
should_log
(
level
::
DEBUG
));
l
.
write
(
msg
);
return
l
;
}
template
<
typename
...
Args
>
inline
c11log
::
details
::
line_logger
c11log
::
logger
::
log
(
level
::
level_enum
lvl
,
const
Args
&
...
args
)
{
details
::
line_logger
l
(
this
,
lvl
,
true
);
...
...
@@ -154,53 +129,33 @@ inline c11log::details::line_logger c11log::logger::log(level::level_enum lvl, c
return
l
;
}
template
<
typename
...
Args
>
inline
c11log
::
details
::
line_logger
c11log
::
logger
::
info
(
const
Args
&
...
args
)
{
details
::
line_logger
l
(
this
,
level
::
INFO
,
should_log
(
level
::
INFO
));
_variadic_log
(
l
,
args
...);
return
l
;
inline
c11log
::
details
::
line_logger
c11log
::
logger
::
trace
(
const
Args
&
...
args
)
{
return
log
(
level
::
TRACE
,
args
...);
}
template
<
typename
T
>
inline
c11log
::
details
::
line_logger
c11log
::
logger
::
warn
(
const
T
&
msg
)
{
details
::
line_logger
l
(
this
,
level
::
WARNING
,
should_log
(
level
::
WARNING
));
l
.
write
(
msg
);
return
l
;
template
<
typename
...
Args
>
inline
c11log
::
details
::
line_logger
c11log
::
logger
::
debug
(
const
Args
&
...
args
)
{
return
log
(
level
::
DEBUG
,
args
...);
}
template
<
typename
T
>
inline
c11log
::
details
::
line_logger
c11log
::
logger
::
critical
(
const
T
&
msg
)
{
details
::
line_logger
l
(
this
,
level
::
CRITICAL
,
should_log
(
level
::
CRITICAL
));
l
.
write
(
msg
);
return
l
;
template
<
typename
...
Args
>
inline
c11log
::
details
::
line_logger
c11log
::
logger
::
info
(
const
Args
&
...
args
)
{
return
log
(
level
::
INFO
,
args
...);
}
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
));
template
<
typename
...
Args
>
inline
c11log
::
details
::
line_logger
c11log
::
logger
::
warn
(
const
Args
&
...
args
)
{
return
log
(
level
::
WARNING
,
args
...);
}
inline
c11log
::
details
::
line_logger
c11log
::
logger
::
warn
()
{
return
details
::
line_logger
(
this
,
level
::
WARNING
,
should_log
(
level
::
WARNING
));
template
<
typename
...
Args
>
inline
c11log
::
details
::
line_logger
c11log
::
logger
::
critical
(
const
Args
&
...
args
)
{
return
log
(
level
::
CRITICAL
,
args
...);
}
inline
c11log
::
details
::
line_logger
c11log
::
logger
::
critical
()
{
return
details
::
line_logger
(
this
,
level
::
CRITICAL
,
should_log
(
level
::
CRITICAL
));
}
inline
const
std
::
string
&
c11log
::
logger
::
name
()
const
...
...
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