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
c3b1aaa7
Commit
c3b1aaa7
authored
Dec 04, 2021
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed custom_flags_example
parent
27ef9442
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
7 deletions
+8
-7
.vs/slnx.sqlite
.vs/slnx.sqlite
+0
-0
example/example.cpp
example/example.cpp
+8
-7
No files found.
.vs/slnx.sqlite
View file @
c3b1aaa7
No preview for this file type
example/example.cpp
View file @
c3b1aaa7
...
...
@@ -22,7 +22,7 @@ void user_defined_example();
void
err_handler_example
();
void
syslog_example
();
void
udp_example
();
void
custom_f
lags
_example
();
void
custom_f
ormatter_flag
_example
();
void
file_events_example
();
void
replace_default_logger_example
();
...
...
@@ -74,7 +74,7 @@ int main(int, char *[])
trace_example
();
stopwatch_example
();
udp_example
();
custom_f
lags
_example
();
custom_f
ormatter_flag
_example
();
}
// Exceptions will only be thrown upon failed logger or sink construction (not during logging).
...
...
@@ -292,7 +292,7 @@ class my_formatter_flag : public spdlog::custom_flag_formatter
public:
void
format
(
const
spdlog
::
details
::
log_msg
&
,
const
std
::
tm
&
,
spdlog
::
memory_buf_t
&
dest
)
override
{
std
::
string
some_txt
=
"
custom
-flag"
;
std
::
string
some_txt
=
"
my
-flag"
;
dest
.
append
(
some_txt
.
data
(),
some_txt
.
data
()
+
some_txt
.
size
());
}
...
...
@@ -302,10 +302,11 @@ public:
}
};
void
custom_f
lags
_example
()
void
custom_f
ormatter_flag
_example
()
{
auto
formatter
=
make_unique
<
spdlog
::
pattern_formatter
>
(
""
);
formatter
->
add_flag
<
my_formatter_flag
>
(
'*'
).
set_pattern
(
"[%n] [%*] [%^%l%$] %v"
);
spdlog
::
set_formatter
(
std
::
move
(
formatter
));
formatter
->
add_flag
<
my_formatter_flag
>
(
'*'
).
set_pattern
(
"[%*] [%^%l%$] %v"
);
spdlog
::
default_logger
()
->
set_formatter
(
std
::
move
(
formatter
));
spdlog
::
info
(
"Custom flag example"
);
}
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