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
e83cc703
Commit
e83cc703
authored
Sep 15, 2021
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
readded set_pattern impl
parent
0bcfc881
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
0 deletions
+15
-0
include/spdlog/logger.h
include/spdlog/logger.h
+1
-0
include/spdlog/pattern_formatter-inl.h
include/spdlog/pattern_formatter-inl.h
+11
-0
include/spdlog/spdlog.h
include/spdlog/spdlog.h
+3
-0
No files found.
include/spdlog/logger.h
View file @
e83cc703
...
@@ -290,6 +290,7 @@ public:
...
@@ -290,6 +290,7 @@ public:
// set formatting for the sinks in this logger.
// set formatting for the sinks in this logger.
// each sink will get a separate instance of the formatter object.
// each sink will get a separate instance of the formatter object.
void
set_formatter
(
std
::
unique_ptr
<
formatter
>
f
);
void
set_formatter
(
std
::
unique_ptr
<
formatter
>
f
);
void
set_pattern
(
std
::
string
pattern
);
// backtrace support.
// backtrace support.
// efficiently store all debug/trace messages in a circular buffer until needed for debugging.
// efficiently store all debug/trace messages in a circular buffer until needed for debugging.
...
...
include/spdlog/pattern_formatter-inl.h
View file @
e83cc703
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
#include <spdlog/details/os.h>
#include <spdlog/details/os.h>
#include <spdlog/fmt/fmt.h>
#include <spdlog/fmt/fmt.h>
#include <spdlog/formatter.h>
#include <spdlog/formatter.h>
#include <spdlog/logger.h>
#include <algorithm>
#include <algorithm>
#include <array>
#include <array>
...
@@ -1287,4 +1288,14 @@ SPDLOG_INLINE void pattern_formatter::compile_pattern_(const std::string &patter
...
@@ -1287,4 +1288,14 @@ SPDLOG_INLINE void pattern_formatter::compile_pattern_(const std::string &patter
formatters_
.
push_back
(
std
::
move
(
user_chars
));
formatters_
.
push_back
(
std
::
move
(
user_chars
));
}
}
}
}
SPDLOG_INLINE
void
set_pattern
(
std
::
string
pattern
)
{
set_formatter
(
details
::
make_unique
<
pattern_formatter
>
(
std
::
move
(
pattern
)));
}
SPDLOG_INLINE
void
logger
::
set_pattern
(
std
::
string
pattern
)
{
this
->
set_formatter
(
details
::
make_unique
<
pattern_formatter
>
(
std
::
move
(
pattern
)));
}
}
// namespace spdlog
}
// namespace spdlog
include/spdlog/spdlog.h
View file @
e83cc703
...
@@ -55,6 +55,9 @@ SPDLOG_API std::shared_ptr<logger> get(const std::string &name);
...
@@ -55,6 +55,9 @@ SPDLOG_API std::shared_ptr<logger> get(const std::string &name);
// example: spdlog::set_formatter(std::make_unique<spdlog::pattern_formatter>("%Y-%m-%d %H:%M:%S.%e %l : %v"));
// example: spdlog::set_formatter(std::make_unique<spdlog::pattern_formatter>("%Y-%m-%d %H:%M:%S.%e %l : %v"));
SPDLOG_API
void
set_formatter
(
std
::
unique_ptr
<
spdlog
::
formatter
>
formatter
);
SPDLOG_API
void
set_formatter
(
std
::
unique_ptr
<
spdlog
::
formatter
>
formatter
);
// Set global log pattern.
SPDLOG_API
void
set_pattern
(
std
::
string
pattern
);
// enable global backtrace support
// enable global backtrace support
SPDLOG_API
void
enable_backtrace
(
size_t
n_messages
);
SPDLOG_API
void
enable_backtrace
(
size_t
n_messages
);
...
...
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