Skip to content

Commit

Permalink
Added event log error logger to service
Browse files Browse the repository at this point in the history
  • Loading branch information
nefarius committed Feb 2, 2024
1 parent 8e0e060 commit 8ed8b66
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions HidHide.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=eventlog/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=POCO/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=uninitialize/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Xbox/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
12 changes: 11 additions & 1 deletion Watchdog/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include <spdlog/spdlog.h>
#include <spdlog/sinks/stdout_color_sinks.h>
#include <spdlog/sinks/win_eventlog_sink.h>

#include <Poco/Task.h>
#include <Poco/TaskManager.h>
Expand Down Expand Up @@ -188,7 +189,16 @@ int App::main(const std::vector<std::string>& args)
const auto console = spdlog::stdout_color_mt("console");
const auto err_logger = spdlog::stderr_color_mt("stderr");

set_default_logger(err_logger);
if (this->isInteractive())
{
set_default_logger(err_logger);
}
else
{
const auto event_log = std::make_shared<spdlog::sinks::win_eventlog_sink_mt>("HidHideWatchdog");
const auto event_logger = std::make_shared<spdlog::logger>("eventlog", event_log);
set_default_logger(event_logger);
}

console->info("Application started");

Expand Down

0 comments on commit 8ed8b66

Please sign in to comment.