diff --git a/LogMonitor/src/LogMonitor/EtwMonitor.cpp b/LogMonitor/src/LogMonitor/EtwMonitor.cpp index 01f22618..546d06a8 100644 --- a/LogMonitor/src/LogMonitor/EtwMonitor.cpp +++ b/LogMonitor/src/LogMonitor/EtwMonitor.cpp @@ -3,7 +3,8 @@ // Licensed under the MIT license. // -#include "pch.h" +#include "pch.h" // NOLINT(build/include_subdir) +#include "EtwMonitor.h" // NOLINT(build/include_subdir) #define MAX_NAME 256 @@ -77,12 +78,17 @@ EtwMonitor::~EtwMonitor() { case ERROR_INVALID_PARAMETER: logWriter.TraceWarning( - Utility::FormatString(L"Invalid TraceHandle or InstanceName is Null or both. Error: %lu", status).c_str() + Utility::FormatString( + L"Invalid TraceHandle or InstanceName is Null or both. Error: %lu", + status).c_str() ); break; case ERROR_ACCESS_DENIED: logWriter.TraceWarning( - Utility::FormatString(L"Only users running with elevated administrative privileges can control event tracing sessions. Error: %lu", status).c_str() + Utility::FormatString( + L"Only users running with elevated administrative privileges can control" + L" event tracing sessions. Error: %lu", + status).c_str() ); break; case ERROR_WMI_INSTANCE_NOT_FOUND: @@ -97,12 +103,15 @@ EtwMonitor::~EtwMonitor() break; default: logWriter.TraceWarning( - Utility::FormatString(L"Another issue might be preventing the stop of the event tracing session. Error: %lu", status).c_str() + Utility::FormatString( + L"Another issue might be preventing the stop of the" + L" event tracing session. Error: %lu", + status).c_str() ); break; } } - + CloseTrace(m_startTraceHandle); @@ -591,10 +600,14 @@ EtwMonitor::StartTraceSession( logWriter.TraceError(L"You cannot update the level when the provider is not registered."); break; case ERROR_NO_SYSTEM_RESOURCES: - logWriter.TraceError(L"Exceeded the number of ETW trace sessions that the provider can enable."); + logWriter.TraceError( + L"Exceeded the number of ETW trace sessions that" + L" the provider can enable."); break; case ERROR_ACCESS_DENIED: - logWriter.TraceError(L"Only users with administrative privileges can enable event providers to a cross-process session."); + logWriter.TraceError( + L"Only users with administrative privileges can enable" + L" event providers to a cross-process session."); break; default: logWriter.TraceError( @@ -810,7 +823,7 @@ EtwMonitor::PrintEvent( ) { DWORD status = ERROR_SUCCESS; - + // struct to hold the Etw log entry and later format print EtwLogEntry logEntry; EtwLogEntry* pLogEntry = &logEntry; diff --git a/LogMonitor/src/LogMonitor/EtwMonitor.h b/LogMonitor/src/LogMonitor/EtwMonitor.h index 50c831e3..98353da3 100644 --- a/LogMonitor/src/LogMonitor/EtwMonitor.h +++ b/LogMonitor/src/LogMonitor/EtwMonitor.h @@ -5,6 +5,9 @@ #pragma once +#include +#include + typedef LPTSTR(NTAPI* PIPV6ADDRTOSTRING)( const IN6_ADDR* Addr, LPTSTR S @@ -30,7 +33,7 @@ struct EtwLogEntry { class EtwMonitor final { -public: + public: EtwMonitor() = delete; EtwMonitor( @@ -43,7 +46,7 @@ class EtwMonitor final static std::wstring EtwFieldsMapping(_In_ std::wstring etwFields, _In_ void* pLogEntryData); -private: + private: static constexpr int ETW_MONITOR_THREAD_EXIT_MAX_WAIT_MILLIS = 5 * 1000; std::vector m_providersConfig; diff --git a/LogMonitor/src/LogMonitor/EventMonitor.cpp b/LogMonitor/src/LogMonitor/EventMonitor.cpp index a9e07497..1e2a7019 100644 --- a/LogMonitor/src/LogMonitor/EventMonitor.cpp +++ b/LogMonitor/src/LogMonitor/EventMonitor.cpp @@ -3,11 +3,11 @@ // Licensed under the MIT license. // -#include "pch.h" +#include "pch.h" // NOLINT(build/include_subdir) +#include "EventMonitor.h" // NOLINT(build/include_subdir) using namespace std; - /// /// EventMonitor.cpp /// @@ -79,6 +79,7 @@ EventMonitor::~EventMonitor() if (waitResult != WAIT_OBJECT_0) { + // Wait failed or timed out } } @@ -156,7 +157,7 @@ EventMonitor::StartEventMonitor() // Order stop event first so that stop is prioritized if both events are already signalled (changes // are available but stop has been called). // - HANDLE aWaitHandles[eventsCount]; + HANDLE aWaitHandles[2]; aWaitHandles[0] = m_stopEvent; @@ -193,7 +194,9 @@ EventMonitor::StartEventMonitor() status = GetLastError(); if (ERROR_EVT_CHANNEL_NOT_FOUND == status) - logWriter.TraceError(L"Failed to subscribe to event log channel. The specified event channel was not found."); + logWriter.TraceError( + L"Failed to subscribe to event log channel." + L" The specified event channel was not found."); else if (ERROR_EVT_INVALID_QUERY == status) logWriter.TraceError( Utility::FormatString( @@ -232,7 +235,8 @@ EventMonitor::StartEventMonitor() { logWriter.TraceError( Utility::FormatString( - L"Failed to subscribe to event log channel. Wait operation on event handle failed. Error: %lu.", + L"Failed to subscribe to event log channel." + L" Wait operation on event handle failed. Error: %lu.", GetLastError()).c_str() ); } @@ -502,7 +506,9 @@ EventMonitor::PrintEvent( // Extract the variant values for each queried property. If the variant failed to get a valid type // set a default value. // - std::wstring providerName = (EvtVarTypeString != variants[EvtSystemProviderName].Type) ? L"" : variants[EvtSystemProviderName].StringVal; + std::wstring providerName = + (EvtVarTypeString != variants[EvtSystemProviderName].Type) + ? L"" : variants[EvtSystemProviderName].StringVal; std::wstring channelName = (EvtVarTypeString != variants[1].Type) ? L"" : variants[1].StringVal; pLogEntry->eventId = (EvtVarTypeUInt16 != variants[2].Type) ? 0 : variants[2].UInt16Val; UINT8 level = (EvtVarTypeByte != variants[3].Type) ? 0 : variants[3].ByteVal; diff --git a/LogMonitor/src/LogMonitor/EventMonitor.h b/LogMonitor/src/LogMonitor/EventMonitor.h index 78b4b94f..2e797acc 100644 --- a/LogMonitor/src/LogMonitor/EventMonitor.h +++ b/LogMonitor/src/LogMonitor/EventMonitor.h @@ -5,10 +5,11 @@ #pragma once +#include + class EventMonitor final { -public: - + public: EventMonitor() = delete; EventMonitor( @@ -23,7 +24,7 @@ class EventMonitor final static std::wstring EventFieldsMapping(_In_ std::wstring eventField, _In_ void* pLogEntryData); -private: + private: static constexpr int EVENT_MONITOR_THREAD_EXIT_MAX_WAIT_MILLIS = 5 * 1000; static constexpr int EVENT_ARRAY_SIZE = 10; diff --git a/LogMonitor/src/LogMonitor/FileMonitor/FileMonitorUtilities.cpp b/LogMonitor/src/LogMonitor/FileMonitor/FileMonitorUtilities.cpp index ba71acee..b21a3c42 100644 --- a/LogMonitor/src/LogMonitor/FileMonitor/FileMonitorUtilities.cpp +++ b/LogMonitor/src/LogMonitor/FileMonitor/FileMonitorUtilities.cpp @@ -3,8 +3,9 @@ // Licensed under the MIT license. // -#include "pch.h" -#include +#include "pch.h" // NOLINT(build/include_subdir) +#include "FileMonitorUtilities.h" // NOLINT(build/include_subdir) +#include // NOLINT(build/include_order) /** * Wrapper around Create Event API diff --git a/LogMonitor/src/LogMonitor/FileMonitor/FileMonitorUtilities.h b/LogMonitor/src/LogMonitor/FileMonitor/FileMonitorUtilities.h index cec70097..9b07e72e 100644 --- a/LogMonitor/src/LogMonitor/FileMonitor/FileMonitorUtilities.h +++ b/LogMonitor/src/LogMonitor/FileMonitor/FileMonitorUtilities.h @@ -7,36 +7,35 @@ class FileMonitorUtilities final { - public: + public: + static HANDLE CreateFileMonitorEvent( + _In_ BOOL bManualReset, + _In_ BOOL bInitialState); - static HANDLE CreateFileMonitorEvent( - _In_ BOOL bManualReset, - _In_ BOOL bInitialState); + static HANDLE GetLogDirHandle( + _In_ std::wstring logDirectory, + _In_ HANDLE stopEvent, + _In_ std::double_t waitInSeconds); - static HANDLE GetLogDirHandle( - _In_ std::wstring logDirectory, - _In_ HANDLE stopEvent, - _In_ std::double_t waitInSeconds); + static void ParseDirectoryValue(_Inout_ std::wstring &directory); - static void ParseDirectoryValue(_Inout_ std::wstring &directory); + static bool IsValidSourceFile(_In_ std::wstring directory, bool includeSubdirectories); - static bool IsValidSourceFile(_In_ std::wstring directory, bool includeSubdirectories); + static bool CheckIsRootFolder(_In_ std::wstring dirPath); - static bool CheckIsRootFolder(_In_ std::wstring dirPath); + private: + static HANDLE _RetryOpenDirectoryWithInterval( + std::wstring logDirectory, + std::double_t waitInSeconds, + HANDLE stopEvent, + HANDLE timerEvent); - private: - static HANDLE _RetryOpenDirectoryWithInterval( - std::wstring logDirectory, - std::double_t waitInSeconds, - HANDLE stopEvent, - HANDLE timerEvent); + static bool _IsFileErrorStatus(DWORD status); - static bool _IsFileErrorStatus(DWORD status); + static std::wstring _GetWaitLogMessage( + std::wstring logDirectory, + std::double_t waitInSeconds); - static std::wstring _GetWaitLogMessage( - std::wstring logDirectory, - std::double_t waitInSeconds); - - static std::wstring _GetParentDir( - std::wstring dirPath); + static std::wstring _GetParentDir( + std::wstring dirPath); }; diff --git a/LogMonitor/src/LogMonitor/JsonFileParser.cpp b/LogMonitor/src/LogMonitor/JsonFileParser.cpp index 1003c2cd..f126c52d 100644 --- a/LogMonitor/src/LogMonitor/JsonFileParser.cpp +++ b/LogMonitor/src/LogMonitor/JsonFileParser.cpp @@ -3,8 +3,9 @@ // Licensed under the MIT license. // -#include "pch.h" -#include +#include "pch.h" // NOLINT(build/include_subdir) +#include "Parser/JsonFileParser.h" // NOLINT(build/include_subdir) +#include // NOLINT(build/include_order) /// JsonFileParser.cpp /// diff --git a/LogMonitor/src/LogMonitor/JsonProcessor.cpp b/LogMonitor/src/LogMonitor/JsonProcessor.cpp index 71899185..f7a10921 100644 --- a/LogMonitor/src/LogMonitor/JsonProcessor.cpp +++ b/LogMonitor/src/LogMonitor/JsonProcessor.cpp @@ -3,13 +3,13 @@ // Licensed under the MIT license. // -#include "pch.h" +#include "pch.h" // NOLINT(build/include_subdir) #include "JsonProcessor.h" // NOLINT(build/include_subdir) -#include -#include -#include -#include -#include +#include // NOLINT(build/include_order) +#include // NOLINT(build/include_order) +#include // NOLINT(build/include_order) +#include // NOLINT(build/include_order) +#include // NOLINT(build/include_order) #ifdef _WIN32 #include @@ -226,7 +226,8 @@ bool handleFileLog( if (!FileMonitorUtilities::IsValidSourceFile(directoryW, includeSubdirs)) { logWriter.TraceError( Utility::FormatString( - L"Invalid File source: root directory cannot be monitored with includeSubdirectories=true. Directory: %s", + L"Invalid File source: root directory cannot be monitored with" + L" includeSubdirectories=true. Directory: %s", directoryW.c_str() ).c_str() ); @@ -319,7 +320,8 @@ bool handleETWLog( if (!etwProvider.StringToLevel(Utility::StringToWString(level))) { logWriter.TraceWarning( Utility::FormatString( - L"Error parsing configuration file. '%S' isn't a valid log level. Setting 'Error' level as default", + L"Error parsing configuration file. '%S' isn't a valid log level." + L" Setting 'Error' level as default", level.c_str() ).c_str() ); diff --git a/LogMonitor/src/LogMonitor/LogFileMonitor.cpp b/LogMonitor/src/LogMonitor/LogFileMonitor.cpp index fa2829c5..335781d7 100644 --- a/LogMonitor/src/LogMonitor/LogFileMonitor.cpp +++ b/LogMonitor/src/LogMonitor/LogFileMonitor.cpp @@ -3,8 +3,9 @@ // Licensed under the MIT license. // -#include "pch.h" -#include +#include "pch.h" // NOLINT(build/include_subdir) +#include "LogFileMonitor.h" // NOLINT(build/include_subdir) +#include // NOLINT(build/include_order) using namespace std; @@ -346,7 +347,7 @@ LogFileMonitor::StartLogFileMonitor() { m_readLogFilesFromStart = true; } - + m_logDirHandle = logDirHandle; // @@ -496,7 +497,8 @@ LogFileMonitor::StartLogFileMonitor() status = GetLastError(); logWriter.TraceError( Utility::FormatString( - L"Failed to monitor log directory changes. Wait operation failed. Log directory: %ws, Error: %d", + L"Failed to monitor log directory changes." + L" Wait operation failed. Log directory: %ws, Error: %d", m_logDirectory.c_str(), status ).c_str() @@ -786,7 +788,8 @@ LogFileMonitor::LogFilesChangeHandlerStatic( { logWriter.TraceError( Utility::FormatString( - L"Failed to monitor log directory changes. Log files in a directory %s will not be monitored. Error: %lu", + L"Failed to monitor log directory changes." + L" Log files in a directory %s will not be monitored. Error: %lu", pThis->m_logDirectory.c_str(), status ).c_str() @@ -860,7 +863,7 @@ LogFileMonitor::LogFilesChangeHandler() if (!SetWaitableTimer(timerEvent, &liDueTime, 0, NULL, NULL, 0)) { status = GetLastError(); - + logWriter.TraceError( Utility::FormatString( L"Failed to set timer object to monitor log file changes in directory %s. Error: %lu", @@ -1014,7 +1017,8 @@ LogFileMonitor::LogFilesChangeHandler() logWriter.TraceError( Utility::FormatString( - L"Failed to wait on directory change notification events to monitor log file changes in directory %s. Error: %lu", + L"Failed to wait on directory change notification events" + L" to monitor log file changes in directory %s. Error: %lu", m_logDirectory.c_str(), status ).c_str() diff --git a/LogMonitor/src/LogMonitor/LogFileMonitor.h b/LogMonitor/src/LogMonitor/LogFileMonitor.h index 6f5ba92e..6c17396c 100644 --- a/LogMonitor/src/LogMonitor/LogFileMonitor.h +++ b/LogMonitor/src/LogMonitor/LogFileMonitor.h @@ -5,8 +5,11 @@ #pragma once -#include +#include #include +#include +#include +#include #define REVERSE_BYTE_ORDER_MARK 0xFFFE #define BYTE_ORDER_MARK 0xFEFF @@ -56,7 +59,7 @@ struct DirChangeNotificationEvent class LogFileMonitor final { -public: + public: LogFileMonitor() = delete; LogFileMonitor( @@ -71,7 +74,7 @@ class LogFileMonitor final static std::wstring FileFieldsMapping(_In_ std::wstring eventFields, _In_ void* pLogEntryData); -private: + private: static constexpr int LOG_MONITOR_THREAD_EXIT_MAX_WAIT_MILLIS = 5 * 1000; static constexpr int RECORDS_BUFFER_SIZE_BYTES = 8 * 1024; diff --git a/LogMonitor/src/LogMonitor/LogWriter.h b/LogMonitor/src/LogMonitor/LogWriter.h index a1a87b9f..dcad4156 100644 --- a/LogMonitor/src/LogMonitor/LogWriter.h +++ b/LogMonitor/src/LogMonitor/LogWriter.h @@ -5,9 +5,11 @@ #pragma once +#include + class LogWriter final { -public: + public: LogWriter() { InitializeSRWLock(&m_stdoutLock); @@ -26,7 +28,7 @@ class LogWriter final ~LogWriter() {} -private: + private: SRWLOCK m_stdoutLock; bool m_isConsole; @@ -38,7 +40,7 @@ class LogWriter final } } -public : + public: bool WriteLog( _In_ HANDLE FileHandle, _In_ LPCVOID Buffer, diff --git a/LogMonitor/src/LogMonitor/Main.cpp b/LogMonitor/src/LogMonitor/Main.cpp index bfe50f95..8d94d1dc 100644 --- a/LogMonitor/src/LogMonitor/Main.cpp +++ b/LogMonitor/src/LogMonitor/Main.cpp @@ -3,8 +3,8 @@ // Licensed under the MIT license. // -#include "pch.h" -#include "Version.h" +#include "pch.h" // NOLINT(build/include_subdir) +#include "Version.h" // NOLINT(build/include_subdir) using namespace std; diff --git a/LogMonitor/src/LogMonitor/Parser/JsonFileParser.h b/LogMonitor/src/LogMonitor/Parser/JsonFileParser.h index dfd420dd..35ceb5f3 100644 --- a/LogMonitor/src/LogMonitor/Parser/JsonFileParser.h +++ b/LogMonitor/src/LogMonitor/Parser/JsonFileParser.h @@ -7,7 +7,7 @@ class JsonFileParser { -public: + public: JsonFileParser(_In_ const wchar_t* BufferStart, size_t BufferLength) : m_buffer(BufferStart), m_bufferLength(BufferLength) @@ -18,7 +18,7 @@ class JsonFileParser AdvanceBufferPointer(0); } - JsonFileParser(_In_ const std::wstring& JsonString) + explicit JsonFileParser(_In_ const std::wstring& JsonString) : JsonFileParser(JsonString.data(), JsonString.size()) { } @@ -55,7 +55,7 @@ class JsonFileParser void SkipValue(); -private: + private: // // Buffer to parse // diff --git a/LogMonitor/src/LogMonitor/Parser/LoggerSettings.h b/LogMonitor/src/LogMonitor/Parser/LoggerSettings.h index 45cb61e3..5c0c171f 100644 --- a/LogMonitor/src/LogMonitor/Parser/LoggerSettings.h +++ b/LogMonitor/src/LogMonitor/Parser/LoggerSettings.h @@ -5,6 +5,8 @@ #pragma once +#include + #define DEFAULT_CONFIG_FILENAME L"C:\\LogMonitor\\LogMonitorConfig.json" #define JSON_TAG_LOG_CONFIG L"LogConfig" @@ -158,7 +160,7 @@ const LPCWSTR LogSourceTypeNames[] = { /// class LogSource { -public: + public: LogSourceType Type; }; @@ -205,7 +207,7 @@ typedef struct _EventLogChannel /// class SourceEventLog : LogSource { -public: + public: std::vector Channels; bool EventFormatMultiLine = true; bool StartAtOldestRecord = false; @@ -267,7 +269,7 @@ class SourceEventLog : LogSource /// class SourceFile : LogSource { -public: + public: std::wstring Directory; std::wstring Filter; bool IncludeSubdirectories = false; @@ -341,7 +343,7 @@ class SourceFile : LogSource /// class ETWProvider { -public: + public: std::wstring ProviderName; std::wstring ProviderGuidStr; GUID ProviderGuid = { 0 }; @@ -395,7 +397,7 @@ class ETWProvider /// class SourceETW : LogSource { -public: + public: std::vector Providers; bool EventFormatMultiLine = true; std::wstring CustomLogFormat = L"[%TimeStamp%] [%Source%] [%Severity%] " @@ -450,7 +452,7 @@ class SourceETW : LogSource /// class SourceProcess : LogSource { - public: + public: std::wstring CustomLogFormat = L"[%TimeStamp%] [%Source%] [%Message%]"; static bool Unwrap( diff --git a/LogMonitor/src/LogMonitor/ProcessMonitor.cpp b/LogMonitor/src/LogMonitor/ProcessMonitor.cpp index 682246d7..2dc4328f 100644 --- a/LogMonitor/src/LogMonitor/ProcessMonitor.cpp +++ b/LogMonitor/src/LogMonitor/ProcessMonitor.cpp @@ -3,7 +3,8 @@ // Licensed under the MIT license. // -#include "pch.h" +#include "pch.h" // NOLINT(build/include_subdir) +#include "ProcessMonitor.h" // NOLINT(build/include_subdir) using namespace std; diff --git a/LogMonitor/src/LogMonitor/ProcessMonitor.h b/LogMonitor/src/LogMonitor/ProcessMonitor.h index d9183a7b..ae6186e3 100644 --- a/LogMonitor/src/LogMonitor/ProcessMonitor.h +++ b/LogMonitor/src/LogMonitor/ProcessMonitor.h @@ -5,6 +5,8 @@ #pragma once +#include + struct ProcessLogEntry { std::wstring source; std::wstring currentTime; @@ -31,7 +33,7 @@ static size_t BufferCopyAndSanitize(char* dst, char* src); class ProcessMonitor final { -public: + public: ProcessMonitor(); static std::wstring ProcessFieldsMapping(_In_ std::wstring eventFields, _In_ void* pLogEntryData); diff --git a/LogMonitor/src/LogMonitor/Utility.cpp b/LogMonitor/src/LogMonitor/Utility.cpp index 134add00..f5bda5a1 100644 --- a/LogMonitor/src/LogMonitor/Utility.cpp +++ b/LogMonitor/src/LogMonitor/Utility.cpp @@ -3,10 +3,10 @@ // Licensed under the MIT license. // -#include "pch.h" +#include "pch.h" // NOLINT(build/include_subdir) #include "Utility.h" // NOLINT(build/include_subdir) -#include -#include +#include // NOLINT(build/include_order) +#include // NOLINT(build/include_order) using namespace std; using json = nlohmann::json; @@ -250,11 +250,11 @@ std::wstring Utility::ReplaceAll(_In_ std::wstring Str, _In_ const std::wstring& } -/// +/// /// helper function for a basic check if a string is a Number (JSON) /// as per the JSON spec - https://www.json.org/json-en.html /// only numbers not covered are those in scientific e-notation -/// +/// bool Utility::isJsonNumber(_In_ std::wstring& str) { wregex isNumber(L"(^\\-?\\d+$)|(^\\-?\\d+\\.\\d+)$"); diff --git a/LogMonitor/src/LogMonitor/Utility.h b/LogMonitor/src/LogMonitor/Utility.h index 86a55e16..5ad75ccc 100644 --- a/LogMonitor/src/LogMonitor/Utility.h +++ b/LogMonitor/src/LogMonitor/Utility.h @@ -5,6 +5,7 @@ #pragma once +#include #include // @@ -22,8 +23,7 @@ typedef std::map AttributesMap; class Utility final { -public: - + public: static const int WAIT_INTERVAL = 15; static std::wstring SystemTimeToString( @@ -90,7 +90,7 @@ class Utility final _In_ void* pLogEntry, _In_ std::wstring sourceType ); - + static bool IsCustomJsonFormat(_Inout_ std::wstring& customLogFormat); static std::string WStringToString(_In_ const std::wstring& wstr); diff --git a/LogMonitor/src/LogMonitor/pch.cpp b/LogMonitor/src/LogMonitor/pch.cpp index d553a2c2..4502b0c1 100644 --- a/LogMonitor/src/LogMonitor/pch.cpp +++ b/LogMonitor/src/LogMonitor/pch.cpp @@ -5,6 +5,6 @@ // pch.cpp: source file corresponding to pre-compiled header; necessary for compilation to succeed -#include "pch.h" +#include "pch.h" // NOLINT(build/include_subdir) // In general, ignore this file, but keep it around if you are using pre-compiled headers. diff --git a/LogMonitor/src/LogMonitor/pch.h b/LogMonitor/src/LogMonitor/pch.h index b118b3ca..4ff660cc 100644 --- a/LogMonitor/src/LogMonitor/pch.h +++ b/LogMonitor/src/LogMonitor/pch.h @@ -2,13 +2,14 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. // -#ifndef PCH_H -#define PCH_H +#ifndef LOGMONITOR_SRC_LOGMONITOR_PCH_H_ +#define LOGMONITOR_SRC_LOGMONITOR_PCH_H_ // TODO(annandaa): reorder the header files as per convention. // currently there are some implicit dependencies, things break when // you try to reorder. +// NOLINTBEGIN(build/include_order) #include #include #include @@ -45,19 +46,20 @@ #include #include #include "shlwapi.h" -#include +#include #include +// NOLINTEND(build/include_order) #include -#include "Utility.h" -#include "Parser/ConfigFileParser.h" -#include "Parser/LoggerSettings.h" -#include "Parser/JsonFileParser.h" -#include "LogWriter.h" -#include "EtwMonitor.h" -#include "EventMonitor.h" -#include "FileMonitor/FileMonitorUtilities.h" -#include "LogFileMonitor.h" -#include "ProcessMonitor.h" -#include "JsonProcessor.h" +#include "Utility.h" // NOLINT(build/include_subdir) +#include "Parser/ConfigFileParser.h" // NOLINT(build/include_subdir) +#include "Parser/LoggerSettings.h" // NOLINT(build/include_subdir) +#include "Parser/JsonFileParser.h" // NOLINT(build/include_subdir) +#include "LogWriter.h" // NOLINT(build/include_subdir) +#include "EtwMonitor.h" // NOLINT(build/include_subdir) +#include "EventMonitor.h" // NOLINT(build/include_subdir) +#include "FileMonitor/FileMonitorUtilities.h" // NOLINT(build/include_subdir) +#include "LogFileMonitor.h" // NOLINT(build/include_subdir) +#include "ProcessMonitor.h" // NOLINT(build/include_subdir) +#include "JsonProcessor.h" // NOLINT(build/include_subdir) -#endif //PCH_H +#endif // LOGMONITOR_SRC_LOGMONITOR_PCH_H_ diff --git a/LogMonitor/src/LogMonitor/resource.h b/LogMonitor/src/LogMonitor/resource.h index 022752d7..a4c366af 100644 --- a/LogMonitor/src/LogMonitor/resource.h +++ b/LogMonitor/src/LogMonitor/resource.h @@ -3,6 +3,9 @@ // Licensed under the MIT license. // +#ifndef LOGMONITOR_SRC_LOGMONITOR_RESOURCE_H_ +#define LOGMONITOR_SRC_LOGMONITOR_RESOURCE_H_ + //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. // Used by LogMonitor.rc @@ -17,3 +20,5 @@ #define _APS_NEXT_SYMED_VALUE 101 #endif #endif + +#endif // LOGMONITOR_SRC_LOGMONITOR_RESOURCE_H_ diff --git a/LogMonitor/src/LogMonitor/version.h b/LogMonitor/src/LogMonitor/version.h index 2ecaed07..e3ae8141 100644 --- a/LogMonitor/src/LogMonitor/version.h +++ b/LogMonitor/src/LogMonitor/version.h @@ -3,8 +3,8 @@ // Licensed under the MIT license. // -#ifndef _VERSION_H_ -#define _VERSION_H_ +#ifndef LOGMONITOR_SRC_LOGMONITOR_VERSION_H_ +#define LOGMONITOR_SRC_LOGMONITOR_VERSION_H_ #define LM_MAJORNUMBER 2 #define LM_MINORNUMBER 1 @@ -13,4 +13,4 @@ // major.minor.patch // #define LM_BUILDMINORVERSION 0 -#endif +#endif // LOGMONITOR_SRC_LOGMONITOR_VERSION_H_