Commit 601bdfb1 authored by gabime's avatar gabime

Minor cleanup

parent 90454a93
......@@ -145,7 +145,7 @@ public:
// get user token
std::vector<unsigned char> buffer(static_cast<size_t>(tusize));
if (!GetTokenInformation(current_process_token.token_handle_, TokenUser, (LPVOID)buffer.data(), tusize, &tusize))
if (!::GetTokenInformation(current_process_token.token_handle_, TokenUser, (LPVOID)buffer.data(), tusize, &tusize))
{
SPDLOG_THROW(win32_error("GetTokenInformation"));
}
......@@ -207,9 +207,11 @@ private:
{
if (!hEventLog_)
{
hEventLog_ = RegisterEventSource(nullptr, source_.c_str());
if (!hEventLog_ || hEventLog_ == (HANDLE) ERROR_ACCESS_DENIED)
hEventLog_ = ::RegisterEventSource(nullptr, source_.c_str());
if (!hEventLog_ || hEventLog_ == (HANDLE)ERROR_ACCESS_DENIED)
{
SPDLOG_THROW(internal::win32_error("RegisterEventSource"));
}
}
return hEventLog_;
......@@ -225,7 +227,7 @@ protected:
formatted.push_back('\0');
LPCSTR lp_str = static_cast<LPCSTR>(formatted.data());
bool succeeded = ReportEvent(
auto succeeded = ::ReportEvent(
event_log_handle(),
eventlog::get_event_type(msg),
eventlog::get_event_category(msg),
......@@ -237,7 +239,9 @@ protected:
nullptr);
if (!succeeded)
{
SPDLOG_THROW(win32_error("ReportEvent"));
}
}
void flush_() override {}
......
#if _WIN32
#include "includes.h"
#include "test_sink.h"
#if _WIN32
#include "spdlog/sinks/win_eventlog_sink.h"
static const LPCSTR TEST_SOURCE = "spdlog_test";
......@@ -66,4 +66,4 @@ TEST_CASE("eventlog", "[eventlog]")
test_single_print([&test_logger] (std::string const& msg) { test_logger.critical(msg); }, "my critical message", EVENTLOG_ERROR_TYPE);
}
#endif
\ No newline at end of file
#endif //_WIN32
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment