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
b396ff85
Commit
b396ff85
authored
Mar 02, 2014
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
common_types.h
parent
3816517e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
0 deletions
+51
-0
example.cpp
example/example.cpp
+4
-0
common_types.h
include/c11log/common_types.h
+27
-0
logger.h
include/c11log/logger.h
+20
-0
No files found.
example/example.cpp
View file @
b396ff85
...
...
@@ -58,7 +58,11 @@ int main(int argc, char* argv[])
auto
&
logger2
=
c11log
::
get_logger
(
"logger2"
);
//logger2.add_sink(fsink2);
logger2
.
add_sink
(
std
::
make_shared
<
sinks
::
null_sink
>
());
logger2
.
add_sink
(
std
::
make_shared
<
sinks
::
stdout_sink
>
());
info_logger
info
(
&
logger2
);
info
<<
"Hello info logger"
<<
"!!"
;
return
0
;
auto
start
=
system_clock
::
now
();
const
unsigned
int
howmany
=
10000000
;
for
(
unsigned
int
i
=
0
;
i
<
howmany
;
i
++
)
...
...
include/c11log/common_types.h
0 → 100644
View file @
b396ff85
#pragma once
#include <chrono>
namespace
c11log
{
typedef
std
::
chrono
::
system_clock
log_clock
;
namespace
level
{
typedef
enum
{
DEBUG
,
INFO
,
WARNING
,
ERROR
,
FATAL
,
NONE
=
99
}
level_enum
;
const
char
*
to_str
(
level_enum
l
);
}
}
static
const
char
*
level_names
[]
{
"Debug"
,
"Info"
,
"Warning"
,
"Error"
,
"Fatal"
};
inline
const
char
*
c11log
::
level
::
to_str
(
c11log
::
level
::
level_enum
l
)
{
return
level_names
[
l
];
}
include/c11log/logger.h
View file @
b396ff85
...
...
@@ -69,8 +69,14 @@ private:
};
logger
&
get_logger
(
const
std
::
string
&
name
);
}
//
// Logger inline impl
//
...
...
@@ -163,3 +169,17 @@ inline c11log::logger& c11log::get_logger(const std::string& name)
return
*
(
c11log
::
details
::
factory
::
instance
().
get_logger
(
name
));
}
namespace
c11log
{
class
info_logger
{
public
:
info_logger
(
c11log
::
logger
*
logger
)
:
_logger
(
logger
)
{}
template
<
class
T
>
details
::
line_logger
&
operator
<<
(
const
T
&
msg
)
{
return
_logger
->
info
()
<<
msg
;
}
private
:
c11log
::
logger
*
_logger
;
};
}
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