Skip to content

Commit

Permalink
Renamed ScopeLogger::INFO as `ILoggerService::LOG_LEVEL::LOG_LEVEL_…
Browse files Browse the repository at this point in the history
…INFO` to prevent confusion with and `SA_LOG(INFO)` calls.
  • Loading branch information
end2endzone committed Aug 24, 2024
1 parent 756b457 commit 7f0a649
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 42 deletions.
2 changes: 1 addition & 1 deletion src/core/ActionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace shellanything

bool ActionManager::Execute(const Menu* menu, const SelectionContext& context)
{
SA_DECLARE_SCOPE_LOGGER_INFO(sli);
SA_DECLARE_SCOPE_LOGGER_ARGS(sli);
sli.verbose = true;
ScopeLogger logger(&sli);

Expand Down
6 changes: 3 additions & 3 deletions src/core/ConfigFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ namespace shellanything

ConfigFile* ConfigFile::LoadFile(const std::string& path, std::string& error)
{
SA_DECLARE_SCOPE_LOGGER_INFO(sli);
SA_DECLARE_SCOPE_LOGGER_ARGS(sli);
sli.verbose = true;
ScopeLogger logger(&sli);

Expand Down Expand Up @@ -347,7 +347,7 @@ namespace shellanything

void ConfigFile::Update(const SelectionContext& context)
{
SA_DECLARE_SCOPE_LOGGER_INFO(sli);
SA_DECLARE_SCOPE_LOGGER_ARGS(sli);
sli.verbose = true;
sli.instance = this;
ScopeLogger logger(&sli);
Expand Down Expand Up @@ -387,7 +387,7 @@ namespace shellanything
{
if (mDefaults && mDefaults->GetActions().size() > 0)
{
SA_DECLARE_SCOPE_LOGGER_INFO(sli);
SA_DECLARE_SCOPE_LOGGER_ARGS(sli);
sli.verbose = true;
ScopeLogger logger(&sli);

Expand Down
4 changes: 2 additions & 2 deletions src/core/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namespace shellanything

void ConfigManager::Refresh()
{
SA_DECLARE_SCOPE_LOGGER_INFO(sli);
SA_DECLARE_SCOPE_LOGGER_ARGS(sli);
ScopeLogger logger(&sli);

//validate existing configurations
Expand Down Expand Up @@ -143,7 +143,7 @@ namespace shellanything

void ConfigManager::Update(const SelectionContext& context)
{
SA_DECLARE_SCOPE_LOGGER_INFO(sli);
SA_DECLARE_SCOPE_LOGGER_ARGS(sli);
sli.verbose = true;
ScopeLogger logger(&sli);

Expand Down
28 changes: 14 additions & 14 deletions src/core/LoggerHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,47 +130,47 @@ namespace shellanything
// ------------------------------------------------------------------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------------------------------------------------------------------

ScopeLogger::ScopeLogger(const ScopeLogger::INFO* info_) :
info(info_)
ScopeLogger::ScopeLogger(const ScopeLogger::ARGS* args_) :
args(args_)
{
// Prepare output text
std::string text;
text += info->name;
if (info->instance != NULL)
text += args->name;
if (args->instance != NULL)
{
text += ",this=";
text += ToHexString(info->instance);
text += ToHexString(args->instance);
}

if (info->filename != NULL)
if (args->filename != NULL)
{
::shellanything::LoggerHelper(info->filename, info->line, info->level, info->verbose) << text;
::shellanything::LoggerHelper(args->filename, args->line, args->level, args->verbose) << text;
}
else
{
::shellanything::LoggerHelper(info->level, info->verbose) << text;
::shellanything::LoggerHelper(args->level, args->verbose) << text;
}
}

ScopeLogger::~ScopeLogger()
{
// Prepare output text
std::string text;
text += info->name;
if (info->instance != NULL)
text += args->name;
if (args->instance != NULL)
{
text += ",this=";
text += ToHexString(info->instance);
text += ToHexString(args->instance);
}
text += " - returns";

if (info->filename != NULL)
if (args->filename != NULL)
{
::shellanything::LoggerHelper(info->filename, info->line, info->level, info->verbose) << text;
::shellanything::LoggerHelper(args->filename, args->line, args->level, args->verbose) << text;
}
else
{
::shellanything::LoggerHelper(info->level, info->verbose) << text;
::shellanything::LoggerHelper(args->level, args->verbose) << text;
}
}

Expand Down
16 changes: 8 additions & 8 deletions src/core/LoggerHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ namespace shellanything
/// </summary>
/// <example>
/// <code>
/// SA_DECLARE_SCOPE_LOGGER_INFO(sli);
/// SA_DECLARE_SCOPE_LOGGER_ARGS(sli);
/// sli.verbose = true;
/// sli.instance = this;
/// ScopeLogger logger(&sli);
Expand All @@ -89,9 +89,9 @@ namespace shellanything
{
public:
/// <summary>
/// Context for a ScopeManager
/// Argument struct for a ScopeManager
/// </summary>
struct INFO
struct ARGS
{
///<summary>The souce code filename generating the log entries.</summary>
const char* filename;
Expand All @@ -108,7 +108,7 @@ namespace shellanything
};

public:
ScopeLogger(const ScopeLogger::INFO* info);
ScopeLogger(const ScopeLogger::ARGS* info);
~ScopeLogger();

private:
Expand All @@ -117,12 +117,12 @@ namespace shellanything
ScopeLogger& operator=(const ScopeLogger&);

public:
const INFO* info;
const ARGS* args;
};

#ifndef SA_DECLARE_SCOPE_LOGGER_INFO
#define SA_DECLARE_SCOPE_LOGGER_INFO(info) \
::shellanything::ScopeLogger::INFO info = {0};\
#ifndef SA_DECLARE_SCOPE_LOGGER_ARGS
#define SA_DECLARE_SCOPE_LOGGER_ARGS(info) \
::shellanything::ScopeLogger::ARGS info = {0};\
info.filename = __FILE__;\
info.line = __LINE__;\
info.name = __FUNCTION__ "()";\
Expand Down
2 changes: 1 addition & 1 deletion src/core/Menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ namespace shellanything

void Menu::Update(const SelectionContext& context)
{
SA_DECLARE_SCOPE_LOGGER_INFO(sli);
SA_DECLARE_SCOPE_LOGGER_ARGS(sli);
sli.verbose = true;
sli.instance = this;
ScopeLogger logger(&sli);
Expand Down
4 changes: 2 additions & 2 deletions src/core/Plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ namespace shellanything

bool Plugin::Load()
{
SA_DECLARE_SCOPE_LOGGER_INFO(sli);
SA_DECLARE_SCOPE_LOGGER_ARGS(sli);
sli.verbose = true;
sli.instance = this;
ScopeLogger logger(&sli);
Expand Down Expand Up @@ -285,7 +285,7 @@ namespace shellanything

bool Plugin::Unload()
{
SA_DECLARE_SCOPE_LOGGER_INFO(sli);
SA_DECLARE_SCOPE_LOGGER_ARGS(sli);
sli.verbose = true;
sli.instance = this;
ScopeLogger logger(&sli);
Expand Down
4 changes: 2 additions & 2 deletions src/core/PropertyManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ namespace shellanything

void PropertyManager::RegisterEnvironmentVariables()
{
SA_DECLARE_SCOPE_LOGGER_INFO(sli);
SA_DECLARE_SCOPE_LOGGER_ARGS(sli);
sli.verbose = true;
ScopeLogger logger(&sli);

Expand All @@ -641,7 +641,7 @@ namespace shellanything

void PropertyManager::RegisterFixedAndDefaultProperties()
{
SA_DECLARE_SCOPE_LOGGER_INFO(sli);
SA_DECLARE_SCOPE_LOGGER_ARGS(sli);
sli.verbose = true;
ScopeLogger logger(&sli);

Expand Down
2 changes: 1 addition & 1 deletion src/core/SelectionContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ namespace shellanything

void SelectionContext::RegisterProperties() const
{
SA_DECLARE_SCOPE_LOGGER_INFO(sli);
SA_DECLARE_SCOPE_LOGGER_ARGS(sli);
sli.verbose = true;
sli.instance = this;
ScopeLogger logger(&sli);
Expand Down
2 changes: 1 addition & 1 deletion src/core/Validator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ namespace shellanything

bool Validator::Validate(const SelectionContext& context) const
{
SA_DECLARE_SCOPE_LOGGER_INFO(sli);
SA_DECLARE_SCOPE_LOGGER_ARGS(sli);
sli.verbose = true;
sli.instance = this;
ScopeLogger logger(&sli);
Expand Down
12 changes: 6 additions & 6 deletions src/shellextension/CContextMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static const GUID CLSID_UNDOCUMENTED_01 = { 0x924502a7, 0xcc8e, 0x4f60, { 0xae,

void CContextMenu::BuildMenuTree(HMENU hMenu, shellanything::Menu* menu, UINT& insert_pos, bool& next_menu_is_column)
{
SA_DECLARE_SCOPE_LOGGER_INFO(sli);
SA_DECLARE_SCOPE_LOGGER_ARGS(sli);
sli.verbose = true;
sli.instance = this;
shellanything::ScopeLogger logger(&sli);
Expand Down Expand Up @@ -268,7 +268,7 @@ void CContextMenu::BuildMenuTree(HMENU hMenu)
//Every 5 times the shell extension popup is displayed, we look for 'unused' bitmap and delete them.
//

SA_DECLARE_SCOPE_LOGGER_INFO(sli);
SA_DECLARE_SCOPE_LOGGER_ARGS(sli);
sli.verbose = true;
sli.instance = this;
shellanything::ScopeLogger logger(&sli);
Expand Down Expand Up @@ -343,7 +343,7 @@ CContextMenu::~CContextMenu()

HRESULT STDMETHODCALLTYPE CContextMenu::QueryContextMenu(HMENU hMenu, UINT menu_index, UINT first_command_id, UINT max_command_id, UINT flags)
{
SA_DECLARE_SCOPE_LOGGER_INFO(sli);
SA_DECLARE_SCOPE_LOGGER_ARGS(sli);
sli.verbose = true;
sli.instance = this;
shellanything::ScopeLogger logger(&sli);
Expand Down Expand Up @@ -434,7 +434,7 @@ HRESULT STDMETHODCALLTYPE CContextMenu::QueryContextMenu(HMENU hMenu, UINT menu_

HRESULT STDMETHODCALLTYPE CContextMenu::InvokeCommand(LPCMINVOKECOMMANDINFO pici)
{
SA_DECLARE_SCOPE_LOGGER_INFO(sli);
SA_DECLARE_SCOPE_LOGGER_ARGS(sli);
sli.verbose = true;
sli.instance = this;
shellanything::ScopeLogger logger(&sli);
Expand Down Expand Up @@ -491,7 +491,7 @@ HRESULT STDMETHODCALLTYPE CContextMenu::InvokeCommand(LPCMINVOKECOMMANDINFO pici

HRESULT STDMETHODCALLTYPE CContextMenu::GetCommandString(UINT_PTR command_id, UINT flags, UINT FAR* reserved, LPSTR pszName, UINT cchMax)
{
SA_DECLARE_SCOPE_LOGGER_INFO(sli);
SA_DECLARE_SCOPE_LOGGER_ARGS(sli);
sli.verbose = true;
sli.instance = this;
shellanything::ScopeLogger logger(&sli);
Expand Down Expand Up @@ -569,7 +569,7 @@ HRESULT STDMETHODCALLTYPE CContextMenu::GetCommandString(UINT_PTR command_id, UI

HRESULT STDMETHODCALLTYPE CContextMenu::Initialize(LPCITEMIDLIST pIDFolder, LPDATAOBJECT pDataObj, HKEY hRegKey)
{
SA_DECLARE_SCOPE_LOGGER_INFO(sli);
SA_DECLARE_SCOPE_LOGGER_ARGS(sli);
sli.verbose = true;
sli.instance = this;
shellanything::ScopeLogger logger(&sli);
Expand Down
2 changes: 1 addition & 1 deletion src/tests/TestLoggerHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ namespace shellanything
{
SA_LOG(INFO) << __FUNCTION__ "(), line " << __LINE__ << " is the first line of code";

SA_DECLARE_SCOPE_LOGGER_INFO(sli);
SA_DECLARE_SCOPE_LOGGER_ARGS(sli);
sli.verbose = true;
sli.level = ::shellanything::ILoggerService::LOG_LEVEL::LOG_LEVEL_INFO; // force INFO level to make sure it is always visible
ScopeLogger logger(&sli);
Expand Down

0 comments on commit 7f0a649

Please sign in to comment.