Skip to content

Commit 3f510d0

Browse files
nr-ahemsathclaude
andcommitted
Disambiguate the logged warning messages
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 8817c67 commit 3f510d0

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

src/Agent/NewRelic/Profiler/Logging/Logger.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,16 @@ namespace NewRelic {
136136
return (_console || (_azureFunctionModeEnabled && !_azureFunctionLogLevelOverride));
137137
}
138138

139+
bool GetConsoleLoggingRestrictsLevel() const
140+
{
141+
return _console;
142+
}
143+
144+
bool GetAzureFunctionModeRestrictsLevel() const
145+
{
146+
return (_azureFunctionModeEnabled && !_azureFunctionLogLevelOverride);
147+
}
148+
139149
_Mymut& mutex() const noexcept
140150
{
141151
return _mutex;

src/Agent/NewRelic/Profiler/Profiler/CorProfilerCallbackImpl.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,8 +1121,11 @@ namespace NewRelic { namespace Profiler {
11211121
if (nrlog::StdLog.GetEnabled())
11221122
{
11231123
LogInfo(L"<-- New logging level set: ", nrlog::GetLevelString(nrlog::StdLog.GetLevel()));
1124-
if (nrlog::StdLog.GetLevelIsRestricted()) {
1125-
LogWarn(L"Logging level is restricted to ", nrlog::GetLevelString(nrlog::StdLog.GetLevel()), L", because either console logging is enabled or this is an Azure Function.");
1124+
if (nrlog::StdLog.GetConsoleLoggingRestrictsLevel()) {
1125+
LogWarn(L"Logging level has been clamped to ", nrlog::GetLevelString(nrlog::StdLog.GetLevel()), L". Console logging at DEBUG or TRACE level incurs a very large performance hit.");
1126+
}
1127+
if (nrlog::StdLog.GetAzureFunctionModeRestrictsLevel()) {
1128+
LogWarn(L"Logging level has been clamped to ", nrlog::GetLevelString(nrlog::StdLog.GetLevel()), L". TRACE level logging in Azure Function mode can cause a crash.");
11261129
}
11271130
if (nrlog::StdLog.GetConsoleLogging())
11281131
{

0 commit comments

Comments
 (0)