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
384cdeb2
Commit
384cdeb2
authored
Jan 14, 2015
by
Denis Ivaykin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nullptr default, astyle
parent
d47fbbb7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
9 deletions
+12
-9
include/spdlog/details/async_log_helper.h
include/spdlog/details/async_log_helper.h
+5
-5
include/spdlog/details/async_logger_impl.h
include/spdlog/details/async_logger_impl.h
+4
-1
include/spdlog/details/registry.h
include/spdlog/details/registry.h
+2
-2
include/spdlog/spdlog.h
include/spdlog/spdlog.h
+1
-1
No files found.
include/spdlog/details/async_log_helper.h
View file @
384cdeb2
...
@@ -125,9 +125,9 @@ private:
...
@@ -125,9 +125,9 @@ private:
// last exception thrown from the worker thread
// last exception thrown from the worker thread
std
::
shared_ptr
<
spdlog_ex
>
_last_workerthread_ex
;
std
::
shared_ptr
<
spdlog_ex
>
_last_workerthread_ex
;
// worker thread warmup callback - one can set thread priority, affinity, etc
// worker thread warmup callback - one can set thread priority, affinity, etc
const
std
::
function
<
void
()
>
_worker_warmup_cb
;
const
std
::
function
<
void
()
>
_worker_warmup_cb
;
// throw last worker thread exception or if worker thread is not active
// throw last worker thread exception or if worker thread is not active
...
@@ -154,7 +154,7 @@ inline spdlog::details::async_log_helper::async_log_helper(formatter_ptr formatt
...
@@ -154,7 +154,7 @@ inline spdlog::details::async_log_helper::async_log_helper(formatter_ptr formatt
_formatter
(
formatter
),
_formatter
(
formatter
),
_sinks
(
sinks
),
_sinks
(
sinks
),
_q
(
queue_size
),
_q
(
queue_size
),
_worker_warmup_cb
(
worker_warmup_cb
),
_worker_warmup_cb
(
worker_warmup_cb
),
_worker_thread
(
&
async_log_helper
::
worker_loop
,
this
)
_worker_thread
(
&
async_log_helper
::
worker_loop
,
this
)
{}
{}
...
@@ -194,7 +194,7 @@ inline void spdlog::details::async_log_helper::worker_loop()
...
@@ -194,7 +194,7 @@ inline void spdlog::details::async_log_helper::worker_loop()
{
{
try
try
{
{
if
(
_worker_warmup_cb
)
_worker_warmup_cb
();
if
(
_worker_warmup_cb
)
_worker_warmup_cb
();
clock
::
time_point
last_pop
=
clock
::
now
();
clock
::
time_point
last_pop
=
clock
::
now
();
while
(
process_next_msg
(
last_pop
));
while
(
process_next_msg
(
last_pop
));
}
}
...
...
include/spdlog/details/async_logger_impl.h
View file @
384cdeb2
...
@@ -44,7 +44,10 @@ inline spdlog::async_logger::async_logger(const std::string& logger_name, sinks_
...
@@ -44,7 +44,10 @@ inline spdlog::async_logger::async_logger(const std::string& logger_name, sinks_
async_logger
(
logger_name
,
sinks
.
begin
(),
sinks
.
end
(),
queue_size
,
worker_warmup_cb
)
{}
async_logger
(
logger_name
,
sinks
.
begin
(),
sinks
.
end
(),
queue_size
,
worker_warmup_cb
)
{}
inline
spdlog
::
async_logger
::
async_logger
(
const
std
::
string
&
logger_name
,
sink_ptr
single_sink
,
size_t
queue_size
,
const
std
::
function
<
void
()
>&
worker_warmup_cb
)
:
inline
spdlog
::
async_logger
::
async_logger
(
const
std
::
string
&
logger_name
,
sink_ptr
single_sink
,
size_t
queue_size
,
const
std
::
function
<
void
()
>&
worker_warmup_cb
)
:
async_logger
(
logger_name
,
{
single_sink
},
queue_size
,
worker_warmup_cb
)
{}
async_logger
(
logger_name
,
{
single_sink
},
queue_size
,
worker_warmup_cb
)
{}
inline
void
spdlog
::
async_logger
::
_set_formatter
(
spdlog
::
formatter_ptr
msg_formatter
)
inline
void
spdlog
::
async_logger
::
_set_formatter
(
spdlog
::
formatter_ptr
msg_formatter
)
...
...
include/spdlog/details/registry.h
View file @
384cdeb2
...
@@ -125,7 +125,7 @@ public:
...
@@ -125,7 +125,7 @@ public:
std
::
lock_guard
<
std
::
mutex
>
lock
(
_mutex
);
std
::
lock_guard
<
std
::
mutex
>
lock
(
_mutex
);
_async_mode
=
true
;
_async_mode
=
true
;
_async_q_size
=
q_size
;
_async_q_size
=
q_size
;
_worker_warmup_cb
=
worker_warmup_cb
;
_worker_warmup_cb
=
worker_warmup_cb
;
}
}
void
set_sync_mode
()
void
set_sync_mode
()
...
@@ -151,7 +151,7 @@ private:
...
@@ -151,7 +151,7 @@ private:
level
::
level_enum
_level
=
level
::
info
;
level
::
level_enum
_level
=
level
::
info
;
bool
_async_mode
=
false
;
bool
_async_mode
=
false
;
size_t
_async_q_size
=
0
;
size_t
_async_q_size
=
0
;
std
::
function
<
void
()
>
_worker_warmup_cb
=
nullptr
;
std
::
function
<
void
()
>
_worker_warmup_cb
=
nullptr
;
};
};
}
}
}
}
include/spdlog/spdlog.h
View file @
384cdeb2
...
@@ -63,7 +63,7 @@ void set_level(level::level_enum log_level);
...
@@ -63,7 +63,7 @@ void set_level(level::level_enum log_level);
// Turn on async mode and set the queue size for each async_logger
// Turn on async mode and set the queue size for each async_logger
void
set_async_mode
(
size_t
queue_size
,
const
std
::
function
<
void
()
>&
worker_warmup_cb
);
void
set_async_mode
(
size_t
queue_size
,
const
std
::
function
<
void
()
>&
worker_warmup_cb
=
nullptr
);
// Turn off async mode
// Turn off async mode
void
set_sync_mode
();
void
set_sync_mode
();
...
...
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