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
d8701890
Commit
d8701890
authored
Feb 09, 2020
by
bandana2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup win_eventlog_sink
parent
2435f46d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
29 deletions
+10
-29
include/spdlog/sinks/win_eventlog_sink.h
include/spdlog/sinks/win_eventlog_sink.h
+10
-29
No files found.
include/spdlog/sinks/win_eventlog_sink.h
View file @
d8701890
...
...
@@ -60,27 +60,6 @@ struct utils
{
report
(
message
.
c_str
());
}
/** Runs a func and reports an exception to stderr if any */
template
<
typename
Result
>
static
Result
report_exceptions
(
std
::
function
<
Result
()
>
func
,
Result
defaultValue
)
{
try
{
return
func
();
}
catch
(
std
::
exception
const
&
e
)
{
report
(
e
.
what
());
return
defaultValue
;
}
}
/** Runs a func and reports an exception to stderr if any */
static
void
report_exceptions
(
std
::
function
<
void
()
>
func
)
{
report_exceptions
<
int
>
([
&
func
]
()
{
func
();
return
0
;
},
0
);
}
};
/** Windows error */
...
...
@@ -279,20 +258,22 @@ public:
:
source_
(
source
)
{
using
namespace
internal
;
utils
::
report_exceptions
([
this
]
()
{
try
{
current_user_sid_
=
sid_t
::
get_current_user_sid
();
});
}
catch
(
std
::
exception
const
&
e
)
{
utils
::
report
(
e
.
what
());
}
}
~
win_eventlog_sink
()
{
using
namespace
internal
;
utils
::
report_exceptions
([
this
]()
{
if
(
hEventLog_
&&
!
DeregisterEventSource
(
hEventLog_
))
utils
::
report
(
win32_error
::
format
(
"DeregisterEventSource"
));
});
}
/**
...
...
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