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
9df2bd25
Commit
9df2bd25
authored
Jul 19, 2018
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed some functions to accept strings instead of ref to strings for better semantics
parent
b238bf95
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
17 deletions
+17
-17
include/spdlog/details/logger_impl.h
include/spdlog/details/logger_impl.h
+6
-6
include/spdlog/details/pattern_formatter.h
include/spdlog/details/pattern_formatter.h
+2
-2
include/spdlog/logger.h
include/spdlog/logger.h
+3
-3
include/spdlog/spdlog.h
include/spdlog/spdlog.h
+6
-6
No files found.
include/spdlog/details/logger_impl.h
View file @
9df2bd25
...
...
@@ -23,14 +23,14 @@ inline spdlog::logger::logger(std::string logger_name, const It &begin, const It
}
// ctor with sinks as init list
inline
spdlog
::
logger
::
logger
(
const
std
::
string
&
logger_name
,
sinks_init_list
sinks_list
)
:
logger
(
logger_name
,
sinks_list
.
begin
(),
sinks_list
.
end
())
inline
spdlog
::
logger
::
logger
(
std
::
string
logger_name
,
sinks_init_list
sinks_list
)
:
logger
(
std
::
move
(
logger_name
)
,
sinks_list
.
begin
(),
sinks_list
.
end
())
{
}
// ctor with single sink
inline
spdlog
::
logger
::
logger
(
const
std
::
string
&
logger_name
,
spdlog
::
sink_ptr
single_sink
)
:
logger
(
logger_name
,
{
std
::
move
(
single_sink
)})
inline
spdlog
::
logger
::
logger
(
std
::
string
logger_name
,
spdlog
::
sink_ptr
single_sink
)
:
logger
(
std
::
move
(
logger_name
)
,
{
std
::
move
(
single_sink
)})
{
}
...
...
@@ -46,9 +46,9 @@ inline void spdlog::logger::set_formatter(const Args &... args)
}
}
inline
void
spdlog
::
logger
::
set_pattern
(
const
std
::
string
&
pattern
,
pattern_time_type
time_type
)
inline
void
spdlog
::
logger
::
set_pattern
(
std
::
string
pattern
,
pattern_time_type
time_type
)
{
set_formatter
<
spdlog
::
pattern_formatter
>
(
pattern
,
time_type
);
set_formatter
<
spdlog
::
pattern_formatter
>
(
std
::
move
(
pattern
)
,
time_type
);
}
template
<
typename
...
Args
>
...
...
include/spdlog/details/pattern_formatter.h
View file @
9df2bd25
...
...
@@ -539,14 +539,14 @@ private:
class
pattern_formatter
SPDLOG_FINAL
:
public
formatter
{
public:
explicit
pattern_formatter
(
const
std
::
string
&
pattern
,
pattern_time_type
time_type
=
pattern_time_type
::
local
,
explicit
pattern_formatter
(
std
::
string
pattern
,
pattern_time_type
time_type
=
pattern_time_type
::
local
,
std
::
string
eol
=
spdlog
::
details
::
os
::
default_eol
)
:
eol_
(
std
::
move
(
eol
))
,
pattern_time_type_
(
time_type
)
,
last_log_secs_
(
0
)
{
std
::
memset
(
&
cached_tm_
,
0
,
sizeof
(
cached_tm_
));
compile_pattern_
(
pattern
);
compile_pattern_
(
std
::
move
(
pattern
)
);
}
pattern_formatter
(
const
pattern_formatter
&
)
=
delete
;
...
...
include/spdlog/logger.h
View file @
9df2bd25
...
...
@@ -28,8 +28,8 @@ namespace spdlog {
class
logger
{
public:
logger
(
const
std
::
string
&
name
,
sink_ptr
single_sink
);
logger
(
const
std
::
string
&
name
,
sinks_init_list
sinks
);
logger
(
std
::
string
name
,
sink_ptr
single_sink
);
logger
(
std
::
string
name
,
sinks_init_list
sinks
);
template
<
typename
It
>
logger
(
std
::
string
name
,
const
It
&
begin
,
const
It
&
end
);
...
...
@@ -114,7 +114,7 @@ public:
// create a pattern formatter all the sinks in this logger.
// each sink gets itw own private copy of a formatter object.
void
set_pattern
(
const
std
::
string
&
pattern
,
pattern_time_type
time_type
=
pattern_time_type
::
local
);
void
set_pattern
(
std
::
string
pattern
,
pattern_time_type
time_type
=
pattern_time_type
::
local
);
// create a FormatterT formatter for each sink in this logger.
// each sink gets its own private copy of a formatter object.
...
...
include/spdlog/spdlog.h
View file @
9df2bd25
...
...
@@ -23,10 +23,10 @@ struct synchronous_factory
{
template
<
typename
Sink
,
typename
...
SinkArgs
>
static
std
::
shared_ptr
<
spdlog
::
logger
>
create
(
const
std
::
string
&
logger_name
,
SinkArgs
&&
...
args
)
static
std
::
shared_ptr
<
spdlog
::
logger
>
create
(
std
::
string
logger_name
,
SinkArgs
&&
...
args
)
{
auto
sink
=
std
::
make_shared
<
Sink
>
(
std
::
forward
<
SinkArgs
>
(
args
)...);
auto
new_logger
=
std
::
make_shared
<
logger
>
(
logger_name
,
std
::
move
(
sink
));
auto
new_logger
=
std
::
make_shared
<
logger
>
(
std
::
move
(
logger_name
)
,
std
::
move
(
sink
));
details
::
registry
::
instance
().
register_and_init
(
new_logger
);
return
new_logger
;
}
...
...
@@ -39,9 +39,9 @@ using default_factory = synchronous_factory;
// Example:
// spdlog::create<daily_file_sink_st>("logger_name", "dailylog_filename", 11, 59);
template
<
typename
Sink
,
typename
...
SinkArgs
>
inline
std
::
shared_ptr
<
spdlog
::
logger
>
create
(
const
std
::
string
&
logger_name
,
SinkArgs
&&
...
sink_args
)
inline
std
::
shared_ptr
<
spdlog
::
logger
>
create
(
std
::
string
logger_name
,
SinkArgs
&&
...
sink_args
)
{
return
default_factory
::
create
<
Sink
>
(
logger_name
,
std
::
forward
<
SinkArgs
>
(
sink_args
)...);
return
default_factory
::
create
<
Sink
>
(
std
::
move
(
logger_name
)
,
std
::
forward
<
SinkArgs
>
(
sink_args
)...);
}
//
...
...
@@ -57,9 +57,9 @@ inline std::shared_ptr<logger> get(const std::string &name)
// Set global formatting
// example: spdlog::set_pattern("%Y-%m-%d %H:%M:%S.%e %l : %v");
//
inline
void
set_pattern
(
const
std
::
string
&
format_string
,
pattern_time_type
time_type
=
pattern_time_type
::
local
)
inline
void
set_pattern
(
std
::
string
format_string
,
pattern_time_type
time_type
=
pattern_time_type
::
local
)
{
details
::
registry
::
instance
().
set_pattern
(
format_string
,
time_type
);
details
::
registry
::
instance
().
set_pattern
(
std
::
move
(
format_string
)
,
time_type
);
}
//
...
...
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