Improve logging performance by conditionally checking trace level

- Introduced a new `isTraceEnabled` function in the logging module to check if trace logging is enabled based on the current log level.
- Updated the `performRequest` function to only log HTTP request details and responses if trace logging is enabled, reducing unnecessary log output and improving performance.

These changes aim to enhance the efficiency of logging during HTTP requests by avoiding excessive logging when not needed.
This commit is contained in:
Joe 2026-03-01 16:43:21 -06:00
parent 33022667dc
commit 25ca0bb27e
2 changed files with 15 additions and 6 deletions

View file

@ -29,6 +29,10 @@ function Log.setLogLevelThunk(thunk)
getLogLevel = thunk
end
function Log.isTraceEnabled()
return getLogLevel() >= Level.Trace
end
function Log.trace(template, ...)
if getLogLevel() >= Level.Trace then
print(addTags(TRACE_TAG, Fmt.fmt(template, ...)))