Skip to content

Commit

Permalink
OrcCommand: FastFind: add support for 'log' option
Browse files Browse the repository at this point in the history
  • Loading branch information
fabienfl-orc committed Feb 11, 2021
1 parent fc89ff1 commit 9d43a50
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/OrcCommand/ConfigFile_FastFind.cpp
Expand Up @@ -12,6 +12,8 @@

#include "ConfigFile_FastFind.h"

#include "Log/UtilitiesLoggerConfiguration.h"

using namespace Orc::Config::Common;

HRESULT Orc::Config::FastFind::object(ConfigItem& parent, DWORD dwIndex)
Expand Down Expand Up @@ -113,6 +115,8 @@ HRESULT Orc::Config::FastFind::root(ConfigItem& item)
return hr;
if (FAILED(hr = item.AddChild(logging, FASTFIND_LOGGING)))
return hr;
if (FAILED(hr = item.AddChild(Orc::Command::UtilitiesLoggerConfiguration::Register, FASTFIND_LOG)))
return hr;
if (FAILED(hr = item.AddChild(filesystem, FASTFIND_FILESYSTEM)))
return hr;
if (FAILED(hr = item.AddChild(registry, FASTFIND_REGISTRY)))
Expand Down
9 changes: 5 additions & 4 deletions src/OrcCommand/ConfigFile_FastFind.h
Expand Up @@ -42,10 +42,11 @@ constexpr auto FASTFIND_REGISTRY_HIVE = 2L;

constexpr auto FASTFIND_VERSION = 0L;
constexpr auto FASTFIND_LOGGING = 1L;
constexpr auto FASTFIND_FILESYSTEM = 2L;
constexpr auto FASTFIND_REGISTRY = 3L;
constexpr auto FASTFIND_SERVICE = 4L;
constexpr auto FASTFIND_OBJECT = 5L;
constexpr auto FASTFIND_LOG = 2L;
constexpr auto FASTFIND_FILESYSTEM = 3L;
constexpr auto FASTFIND_REGISTRY = 4L;
constexpr auto FASTFIND_SERVICE = 5L;
constexpr auto FASTFIND_OBJECT = 6L;

constexpr auto FASTFIND_OUTPUT_FILESYSTEM = 6L;
constexpr auto FASTFIND_OUTPUT_REGISTRY = 7L;
Expand Down
15 changes: 15 additions & 0 deletions src/OrcCommand/FastFind_Config.cpp
Expand Up @@ -73,6 +73,17 @@ HRESULT Main::GetConfigurationFromConfig(const ConfigItem& configitem)
{
return hr;
}

if (configitem[FASTFIND_LOGGING])
{
Log::Warn(L"The '<logging> configuration element is deprecated, please use '<log>' instead");
}

if (configitem[FASTFIND_LOG])
{
UtilitiesLoggerConfiguration::Parse(configitem[FASTFIND_LOG], m_utilitiesConfig.log);
}

if (FAILED(
hr = config.outObject.Configure(
static_cast<OutputSpec::Kind>(OutputSpec::Kind::TableFile), configitem[FASTFIND_OUTPUT_OBJECT])))
Expand Down Expand Up @@ -225,6 +236,8 @@ HRESULT Main::GetConfigurationFromArgcArgv(int argc, LPCWSTR argv[])
{
HRESULT hr = E_FAIL;

UtilitiesLoggerConfiguration::Parse(argc, argv, m_utilitiesConfig.log);

for (int i = 0; i < argc; i++)
{
switch (argv[i][0])
Expand Down Expand Up @@ -316,6 +329,8 @@ HRESULT Main::CheckConfiguration()
{
HRESULT hr = E_FAIL;

UtilitiesLoggerConfiguration::Apply(m_logging, m_utilitiesConfig.log);

bool bSomeThingToParse = false;

config.FileSystem.Locations.Consolidate(config.bAddShadows, FSVBR::FSType::NTFS);
Expand Down

0 comments on commit 9d43a50

Please sign in to comment.