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
ff824cdb
Commit
ff824cdb
authored
Mar 30, 2014
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
logger small fixes
parent
98476e22
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
example.cpp
example/example.cpp
+1
-1
logger.h
include/c11log/logger.h
+8
-8
No files found.
example/example.cpp
View file @
ff824cdb
...
...
@@ -32,7 +32,7 @@ int main(int argc, char* argv[])
auto
start
=
system_clock
::
now
();
for
(
unsigned
int
i
=
1
;
i
<=
howmany
;
++
i
)
my_logger
.
debug
()
<<
"Hello logger: "
;
my_logger
.
info
()
<<
"Hello logger: "
;
//auto s = howmany - as->q().size();
auto
s
=
howmany
;
...
...
include/c11log/logger.h
View file @
ff824cdb
...
...
@@ -44,7 +44,7 @@ public:
logger
&
operator
=
(
const
logger
&
)
=
delete
;
logger
&
operator
=
(
logger
&&
)
=
delete
;
void
set_level
(
c11log
::
level
::
level_enum
);
void
set_
min_
level
(
c11log
::
level
::
level_enum
);
c11log
::
level
::
level_enum
get_level
()
const
;
const
std
::
string
&
get_name
()
const
;
...
...
@@ -65,7 +65,7 @@ private:
std
::
string
_logger_name
;
formatter_ptr
_formatter
;
sinks_vector_t
_sinks
;
std
::
atomic_int
_
level_threshold
;
std
::
atomic_int
_
min_level
;
void
_log_it
(
const
details
::
log_msg
&
msg
);
...
...
@@ -87,7 +87,7 @@ inline c11log::logger::logger(const std::string& name, sinks_init_list sinks_lis
_sinks
(
sinks_list
)
{
//Seems that vs2013 doesnt support std::atomic member initialization, so its done here
_
level_threshold
=
level
::
INFO
;
_
min_level
=
level
::
INFO
;
if
(
!
_formatter
)
_formatter
=
std
::
make_shared
<
formatters
::
default_formatter
>
();
}
...
...
@@ -99,7 +99,7 @@ inline c11log::logger::logger(const std::string& name, sink_ptr sink, formatter_
inline
c11log
::
details
::
line_logger
c11log
::
logger
::
log
(
c11log
::
level
::
level_enum
msg_level
)
{
return
details
::
line_logger
(
this
,
msg_level
,
msg_level
>=
_
level_threshold
);
return
details
::
line_logger
(
this
,
msg_level
,
msg_level
>=
_
min_level
);
}
inline
c11log
::
details
::
line_logger
c11log
::
logger
::
debug
()
...
...
@@ -135,19 +135,19 @@ inline const std::string& c11log::logger::get_name() const
return
_logger_name
;
}
inline
void
c11log
::
logger
::
set_level
(
c11log
::
level
::
level_enum
level
)
inline
void
c11log
::
logger
::
set_
min_
level
(
c11log
::
level
::
level_enum
level
)
{
_
level_threshold
.
store
(
level
);
_
min_level
.
store
(
level
);
}
inline
c11log
::
level
::
level_enum
c11log
::
logger
::
get_level
()
const
{
return
static_cast
<
c11log
::
level
::
level_enum
>
(
_
level_threshold
.
load
());
return
static_cast
<
c11log
::
level
::
level_enum
>
(
_
min_level
.
load
());
}
inline
bool
c11log
::
logger
::
should_log
(
c11log
::
level
::
level_enum
level
)
const
{
return
level
>=
_
level_threshold
.
load
();
return
level
>=
_
min_level
.
load
();
}
inline
void
c11log
::
logger
::
_log_it
(
const
details
::
log_msg
&
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