Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert global loggers to Thread local loggers #3

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

sachintaMSFT
Copy link
Owner

No description provided.

@sachintaMSFT sachintaMSFT marked this pull request as ready for review May 1, 2021 01:53
@@ -102,6 +105,8 @@ namespace AppInstaller::CLI::Execution
}

virtual void SetExecutionStage(Workflow::ExecutionStage stage, bool);

void SetThreadLocalThreadGlobals();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need to return the internal RAII type that ThreadGlobals will return from its SetActive type function.

void TelemetryTraceLogger::LogFailure(const wil::FailureInfo& failure) const noexcept
{
if (IsTelemetryEnabled())
{
TraceLoggingWriteActivity(g_hTelemetryProvider,
TraceLoggingWriteActivity(g_hTraceProvider,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why update all of these lines just to change the global name? What value is there in changing the name of the global?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The value is not in any better functionality but in it communicating truly what it is. The provider is NOW not only used for logging Telemetry but Diagnostic events as well.

@@ -31,7 +31,7 @@ namespace AppInstaller::Logging
// ILogger
virtual std::string GetName() const override;

virtual void Write(Channel channel, Level level, std::string_view message) noexcept override;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will fix this!

@@ -64,6 +64,7 @@ namespace AppInstaller::Logging
// Send to a string first to create a single block to write to a file.
std::stringstream strstr;
strstr << std::chrono::system_clock::now() << " [" << std::setw(GetMaxChannelNameLength()) << std::left << std::setfill(' ') << GetChannelName(channel) << "] " << message;

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will remove the extra line!

};

// Helper to make the call sites look clean.
TelemetryTraceLogger& Telemetry();

// Turns on wil failure telemetry and logging.
void EnableWilFailureTelemetry();
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will revert the location of this method's declaration to reflect no change to this method!

@@ -147,6 +161,9 @@ namespace AppInstaller::Logging
DestructionToken m_token;
};

// Turns on wil failure telemetry and logging.
void EnableWilFailureTelemetry();
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will revert the location of this method's declaration to reflect no change to this method!

virtual std::string GetName() const override;
virtual void Write(Channel channel, Level, std::string_view message) noexcept override;
};
}
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will add new line at the end of the file

@@ -27,6 +27,7 @@ extern "C"
AppInstaller::Logging::Log().EnableChannel(AppInstaller::Logging::Channel::All);
AppInstaller::Logging::Log().SetLevel(AppInstaller::Logging::Level::Verbose);
AppInstaller::Logging::EnableWilFailureTelemetry();
AppInstaller::Logging::Telemetry().SetUserSettingsStatus();
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed this! Will remove this call !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants