Skip to content

Commit 0e7d9c2

Browse files
authored
Merge pull request #219 from microsoft/reducestreamverbosity
Eliminate unnecessary argument from FunctionTracer and derived classes
2 parents 82b856e + 70ca9b2 commit 0e7d9c2

File tree

6 files changed

+16
-18
lines changed

6 files changed

+16
-18
lines changed

src/common/service/NetRemoteApiTrace.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88

99
using namespace Microsoft::Net::Remote::Service::Tracing;
1010

11-
NetRemoteApiTrace::NetRemoteApiTrace(bool deferEnter, plog::Severity logSeverityEnter, plog::Severity logSeverityExit, std::source_location location) :
12-
logging::FunctionTracer(logSeverityEnter, logSeverityExit, LogTracePrefix, {}, deferEnter, location)
11+
NetRemoteApiTrace::NetRemoteApiTrace(bool deferEnter, plog::Severity logSeverity, std::source_location location) :
12+
logging::FunctionTracer(logSeverity, LogTracePrefix, {}, deferEnter, location)
1313
{}

src/common/service/NetRemoteApiTrace.hxx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ struct NetRemoteApiTrace :
1919
* @brief Construct a new NetRemoteApiTrace object.
2020
*
2121
* @param deferEnter Whether to defer the entry log message upon construction.
22-
* @param logSeverityEnter The log severity to use when tracing function entrance.
23-
* @param logSeverityExit The log severity to use when tracing function exit.
22+
* @param logSeverity The default log severity to use when tracing.
2423
* @param location The source code location of the function call.
2524
*/
26-
NetRemoteApiTrace(bool deferEnter = false, plog::Severity logSeverityEnter = LogSeverityDefaultApi, plog::Severity logSeverityExit = LogSeverityDefaultApi, std::source_location location = std::source_location::current());
25+
NetRemoteApiTrace(bool deferEnter = false, plog::Severity logSeverity = LogSeverityDefaultApi, std::source_location location = std::source_location::current());
2726

2827
protected:
2928
static constexpr auto LogSeverityDefaultApi{ plog::Severity::info };

src/common/service/NetRemoteWifiApiTrace.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ using namespace Microsoft::Net::Remote::Service::Tracing;
1616
using Microsoft::Net::Remote::Wifi::WifiAccessPointOperationStatus;
1717
using Microsoft::Net::Remote::Wifi::WifiAccessPointOperationStatusCode;
1818

19-
NetRemoteWifiApiTrace::NetRemoteWifiApiTrace(std::optional<std::string> accessPointId, const WifiAccessPointOperationStatus* operationStatus, plog::Severity logSeverityEnter, plog::Severity logSeverityExit, std::source_location location) :
20-
NetRemoteApiTrace(/* deferEnter= */ true, logSeverityEnter, logSeverityExit, location),
19+
NetRemoteWifiApiTrace::NetRemoteWifiApiTrace(std::optional<std::string> accessPointId, const WifiAccessPointOperationStatus* operationStatus, plog::Severity logSeverity, std::source_location location) :
20+
NetRemoteApiTrace(/* deferEnter= */ true, logSeverity, location),
2121
m_accessPointId(std::move(accessPointId)),
2222
m_operationStatus(operationStatus)
2323
{

src/common/service/NetRemoteWifiApiTrace.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ struct NetRemoteWifiApiTrace :
2828
* @param operationStatus The result status of the operation, if present.
2929
* @param location The source code location of the function call.
3030
*/
31-
NetRemoteWifiApiTrace(std::optional<std::string> accessPointId = std::nullopt, const Microsoft::Net::Remote::Wifi::WifiAccessPointOperationStatus* operationStatus = nullptr, plog::Severity logSeverityEnter = LogSeverityDefaultApi, plog::Severity logSeverityExit = LogSeverityDefaultApi, std::source_location location = std::source_location::current());
31+
NetRemoteWifiApiTrace(std::optional<std::string> accessPointId = std::nullopt, const Microsoft::Net::Remote::Wifi::WifiAccessPointOperationStatus* operationStatus = nullptr, plog::Severity logSeverity = LogSeverityDefaultApi, std::source_location location = std::source_location::current());
3232

3333
/**
3434
* @brief Destroy the NetRemoteWifiApiTrace object.

src/common/shared/logging/FunctionTracer.cxx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ BuildValueList(const std::vector<std::pair<std::string, std::string>>& values, s
3939
}
4040
} // namespace detail
4141

42-
FunctionTracer::FunctionTracer(plog::Severity logSeverityEnter, plog::Severity logSeverityExit, std::string logPrefix, std::vector<std::pair<std::string, std::string>> arguments, bool deferEnter, std::source_location location) :
43-
m_logSeverityEnter(logSeverityEnter),
44-
m_logSeverityExit(logSeverityExit),
42+
FunctionTracer::FunctionTracer(plog::Severity logSeverity, std::string logPrefix, std::vector<std::pair<std::string, std::string>> arguments, bool deferEnter, std::source_location location) :
43+
m_logSeverityEnter(logSeverity),
44+
m_logSeverityExit(logSeverity),
4545
m_logPrefix(std::move(logPrefix)),
4646
m_location(location),
4747
m_functionName(m_location.function_name()),
@@ -119,13 +119,13 @@ FunctionTracer::SetFailed() noexcept
119119
}
120120

121121
void
122-
FunctionTracer::SetEnterLogSeverity(plog::Severity logSeverityEnter) noexcept
122+
FunctionTracer::SetEnterLogSeverity(plog::Severity logSeverity) noexcept
123123
{
124124
if (m_entered) {
125125
LOGW << "warning: calling SetEnterLogSeverity after entered log has already been printed; this will have no effect.";
126126
}
127127

128-
m_logSeverityEnter = logSeverityEnter;
128+
m_logSeverityEnter = logSeverity;
129129
}
130130

131131
void

src/common/shared/logging/include/logging/FunctionTracer.hxx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,13 @@ struct FunctionTracer
2424
/**
2525
* @brief Construct a new FunctionTracer object.
2626
*
27-
* @param logSeverityEnter The severity to log entrance with.
28-
* @param logSeverityExit The severity to log exit with.
27+
* @param logSeverity The default severity to log with.
2928
* @param logPrefix The prefix to use for both log messages.
3029
* @param arguments The arguments the function was called with.
3130
* @param deferEnter Whether to defer the call to Enter().
3231
* @param location The source location information of the caller.
3332
*/
34-
FunctionTracer(plog::Severity logSeverityEnter = LogSeverityEnterDefault, plog::Severity logSeverityExit = LogSeverityExitDefault, std::string logPrefix = {}, std::vector<std::pair<std::string, std::string>> arguments = {}, bool deferEnter = false, std::source_location location = std::source_location::current());
33+
FunctionTracer(plog::Severity logSeverity = LogSeverityEnterDefault, std::string logPrefix = {}, std::vector<std::pair<std::string, std::string>> arguments = {}, bool deferEnter = false, std::source_location location = std::source_location::current());
3534

3635
/**
3736
* @brief Destroy the FunctionTracer object.
@@ -84,10 +83,10 @@ struct FunctionTracer
8483
* @brief Manually set the log severity for the enter log message. This only has an effect if the object was created
8584
* with deferEnter = true.
8685
*
87-
* @param logSeverityEnter The log severity to use when printing the entrance log message.
86+
* @param logSeverity The log severity to use when printing the entrance log message.
8887
*/
8988
void
90-
SetEnterLogSeverity(plog::Severity logSeverityEnter) noexcept;
89+
SetEnterLogSeverity(plog::Severity logSeverity) noexcept;
9190

9291
/**
9392
* @brief Manually set the log severity for the exit log message. This overrides the SetSucceeded and SetFailed methods.

0 commit comments

Comments
 (0)