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
9ce66f2c
Commit
9ce66f2c
authored
Feb 25, 2018
by
Daniel Chabrowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modernize-pass-by-value
parent
ad624432
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
37 additions
and
38 deletions
+37
-38
async_log_helper.h
include/spdlog/details/async_log_helper.h
+21
-24
logger_impl.h
include/spdlog/details/logger_impl.h
+2
-2
pattern_formatter_impl.h
include/spdlog/details/pattern_formatter_impl.h
+3
-2
formatter.h
include/spdlog/formatter.h
+1
-1
logger.h
include/spdlog/logger.h
+2
-2
file_sinks.h
include/spdlog/sinks/file_sinks.h
+8
-7
No files found.
include/spdlog/details/async_log_helper.h
View file @
9ce66f2c
...
...
@@ -43,6 +43,7 @@ class async_log_helper
flush
,
terminate
};
struct
async_msg
{
std
::
string
logger_name
;
...
...
@@ -56,24 +57,23 @@ class async_log_helper
async_msg
()
=
default
;
~
async_msg
()
=
default
;
async_msg
(
async_msg
&&
other
)
SPDLOG_NOEXCEPT
:
logger_name
(
std
::
move
(
other
.
logger_name
)),
level
(
std
::
move
(
other
.
level
)),
time
(
std
::
move
(
other
.
time
)),
thread_id
(
other
.
thread_id
),
txt
(
std
::
move
(
other
.
txt
)),
msg_type
(
std
::
move
(
other
.
msg_type
)),
msg_id
(
other
.
msg_id
)
{}
explicit
async_msg
(
async_msg_type
m_type
)
:
explicit
async_msg
(
async_msg_type
m_type
)
:
level
(
level
::
info
),
thread_id
(
0
),
msg_type
(
m_type
),
msg_id
(
0
)
{}
async_msg
(
async_msg
&&
other
)
SPDLOG_NOEXCEPT
:
logger_name
(
std
::
move
(
other
.
logger_name
)),
level
(
std
::
move
(
other
.
level
)),
time
(
std
::
move
(
other
.
time
)),
thread_id
(
other
.
thread_id
),
txt
(
std
::
move
(
other
.
txt
)),
msg_type
(
std
::
move
(
other
.
msg_type
)),
msg_id
(
other
.
msg_id
)
{}
async_msg
&
operator
=
(
async_msg
&&
other
)
SPDLOG_NOEXCEPT
{
logger_name
=
std
::
move
(
other
.
logger_name
);
...
...
@@ -104,7 +104,6 @@ async_msg(async_msg&& other) SPDLOG_NOEXCEPT:
#endif
}
// copy into log_msg
void
fill_log_msg
(
log_msg
&
msg
)
{
...
...
@@ -118,21 +117,19 @@ async_msg(async_msg&& other) SPDLOG_NOEXCEPT:
};
public
:
using
item_type
=
async_msg
;
using
q_type
=
details
::
mpmc_bounded_queue
<
item_type
>
;
using
clock
=
std
::
chrono
::
steady_clock
;
async_log_helper
(
formatter_ptr
formatter
,
const
std
::
vector
<
sink_ptr
>&
sinks
,
std
::
vector
<
sink_ptr
>
sinks
,
size_t
queue_size
,
const
log_err_handler
err_handler
,
const
async_overflow_policy
overflow_policy
=
async_overflow_policy
::
block_retry
,
const
std
::
function
<
void
()
>&
worker_warmup_cb
=
nullptr
,
std
::
function
<
void
()
>
worker_warmup_cb
=
nullptr
,
const
std
::
chrono
::
milliseconds
&
flush_interval_ms
=
std
::
chrono
::
milliseconds
::
zero
(),
const
std
::
function
<
void
()
>&
worker_teardown_cb
=
nullptr
);
std
::
function
<
void
()
>
worker_teardown_cb
=
nullptr
);
void
log
(
const
details
::
log_msg
&
msg
);
...
...
@@ -200,23 +197,23 @@ private:
///////////////////////////////////////////////////////////////////////////////
inline
spdlog
::
details
::
async_log_helper
::
async_log_helper
(
formatter_ptr
formatter
,
const
std
::
vector
<
sink_ptr
>&
sinks
,
std
::
vector
<
sink_ptr
>
sinks
,
size_t
queue_size
,
log_err_handler
err_handler
,
const
async_overflow_policy
overflow_policy
,
const
std
::
function
<
void
()
>&
worker_warmup_cb
,
std
::
function
<
void
()
>
worker_warmup_cb
,
const
std
::
chrono
::
milliseconds
&
flush_interval_ms
,
const
std
::
function
<
void
()
>&
worker_teardown_cb
)
:
std
::
function
<
void
()
>
worker_teardown_cb
)
:
_formatter
(
std
::
move
(
formatter
)),
_sinks
(
s
inks
),
_sinks
(
s
td
::
move
(
sinks
)
),
_q
(
queue_size
),
_err_handler
(
std
::
move
(
err_handler
)),
_flush_requested
(
false
),
_terminate_requested
(
false
),
_overflow_policy
(
overflow_policy
),
_worker_warmup_cb
(
worker_warmup_cb
),
_worker_warmup_cb
(
std
::
move
(
worker_warmup_cb
)
),
_flush_interval_ms
(
flush_interval_ms
),
_worker_teardown_cb
(
worker_teardown_cb
)
_worker_teardown_cb
(
std
::
move
(
worker_teardown_cb
)
)
{
_worker_thread
=
std
::
thread
(
&
async_log_helper
::
worker_loop
,
this
);
}
...
...
include/spdlog/details/logger_impl.h
View file @
9ce66f2c
...
...
@@ -14,8 +14,8 @@
// create logger with given name, sinks and the default pattern formatter
// all other ctors will call this one
template
<
class
It
>
inline
spdlog
::
logger
::
logger
(
const
std
::
string
&
logger_name
,
const
It
&
begin
,
const
It
&
end
)
:
_name
(
logger_name
),
inline
spdlog
::
logger
::
logger
(
std
::
string
logger_name
,
const
It
&
begin
,
const
It
&
end
)
:
_name
(
std
::
move
(
logger_name
)
),
_sinks
(
begin
,
end
),
_formatter
(
std
::
make_shared
<
pattern_formatter
>
(
"%+"
)),
_level
(
level
::
info
),
...
...
include/spdlog/details/pattern_formatter_impl.h
View file @
9ce66f2c
...
...
@@ -476,8 +476,9 @@ class full_formatter SPDLOG_FINAL : public flag_formatter
///////////////////////////////////////////////////////////////////////////////
// pattern_formatter inline impl
///////////////////////////////////////////////////////////////////////////////
inline
spdlog
::
pattern_formatter
::
pattern_formatter
(
const
std
::
string
&
pattern
,
pattern_time_type
pattern_time
,
const
std
::
string
&
eol
)
:
_eol
(
eol
),
_pattern_time
(
pattern_time
)
inline
spdlog
::
pattern_formatter
::
pattern_formatter
(
const
std
::
string
&
pattern
,
pattern_time_type
pattern_time
,
std
::
string
eol
)
:
_eol
(
std
::
move
(
eol
)),
_pattern_time
(
pattern_time
)
{
compile_pattern
(
pattern
);
}
...
...
include/spdlog/formatter.h
View file @
9ce66f2c
...
...
@@ -28,7 +28,7 @@ public:
class
pattern_formatter
SPDLOG_FINAL
:
public
formatter
{
public
:
explicit
pattern_formatter
(
const
std
::
string
&
pattern
,
pattern_time_type
pattern_time
=
pattern_time_type
::
local
,
const
std
::
string
&
eol
=
spdlog
::
details
::
os
::
default_eol
);
explicit
pattern_formatter
(
const
std
::
string
&
pattern
,
pattern_time_type
pattern_time
=
pattern_time_type
::
local
,
std
::
string
eol
=
spdlog
::
details
::
os
::
default_eol
);
pattern_formatter
(
const
pattern_formatter
&
)
=
delete
;
pattern_formatter
&
operator
=
(
const
pattern_formatter
&
)
=
delete
;
void
format
(
details
::
log_msg
&
msg
)
override
;
...
...
include/spdlog/logger.h
View file @
9ce66f2c
...
...
@@ -28,13 +28,13 @@ public:
logger
(
const
std
::
string
&
name
,
sink_ptr
single_sink
);
logger
(
const
std
::
string
&
name
,
sinks_init_list
);
template
<
class
It
>
logger
(
const
std
::
string
&
name
,
const
It
&
begin
,
const
It
&
end
);
logger
(
std
::
string
name
,
const
It
&
begin
,
const
It
&
end
);
virtual
~
logger
();
logger
(
const
logger
&
)
=
delete
;
logger
&
operator
=
(
const
logger
&
)
=
delete
;
template
<
typename
...
Args
>
void
log
(
level
::
level_enum
lvl
,
const
char
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
void
log
(
level
::
level_enum
lvl
,
const
char
*
msg
);
template
<
typename
Arg1
,
typename
...
Args
>
void
trace
(
const
char
*
fmt
,
const
Arg1
&
,
const
Args
&
...
args
);
...
...
include/spdlog/sinks/file_sinks.h
View file @
9ce66f2c
...
...
@@ -25,7 +25,7 @@ namespace sinks
/*
* Trivial file sink with single file as target
*/
template
<
class
Mutex
>
template
<
class
Mutex
>
class
simple_file_sink
SPDLOG_FINAL
:
public
base_sink
<
Mutex
>
{
public
:
...
...
@@ -63,13 +63,13 @@ using simple_file_sink_st = simple_file_sink<details::null_mutex>;
/*
* Rotating file sink based on size
*/
template
<
class
Mutex
>
class
rotating_file_sink
SPDLOG_FINAL
:
public
base_sink
<
Mutex
>
template
<
class
Mutex
>
class
rotating_file_sink
SPDLOG_FINAL
:
public
base_sink
<
Mutex
>
{
public
:
rotating_file_sink
(
const
filename_t
&
base_filename
,
rotating_file_sink
(
filename_t
base_filename
,
std
::
size_t
max_size
,
std
::
size_t
max_files
)
:
_base_filename
(
base_filename
),
_base_filename
(
std
::
move
(
base_filename
)
),
_max_size
(
max_size
),
_max_files
(
max_files
),
_current_size
(
0
),
...
...
@@ -197,9 +197,10 @@ class daily_file_sink SPDLOG_FINAL :public base_sink < Mutex >
public
:
//create daily file sink which rotates on given time
daily_file_sink
(
const
filename_t
&
base_filename
,
filename_t
base_filename
,
int
rotation_hour
,
int
rotation_minute
)
:
_base_filename
(
base_filename
),
int
rotation_minute
)
:
_base_filename
(
std
::
move
(
base_filename
)),
_rotation_h
(
rotation_hour
),
_rotation_m
(
rotation_minute
)
{
...
...
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