NREL / OpenStudio

OpenStudio is a cross-platform collection of software tools to support whole building energy modeling using EnergyPlus and advanced daylight analysis using Radiance.
https://www.openstudio.net/
Other
494 stars 188 forks source link

Adjust LogSink log formatter #5037

Closed jmarrec closed 9 months ago

jmarrec commented 9 months ago

Issue overview

Prompted by the fact that the run.log looks quite different between the classic (Ruby) and the C++ CLI.

Additionally, the default formatter is not great. The use of Integers for the log level is unnecessarily confusing. I think I know how to turn the LogLevel enum into a string (eg: "Debug" instead of -1)

https://github.com/NREL/OpenStudio/blob/3f35a4ce446e1e91a4ec0c559aeca226b2715099/src/utilities/core/LogSink.cpp#L126-L131

Current Behavior

C++

[openstudio.measure.OSRunner] <0> runner.registerWarning called
[openstudio.workflow.OSWorkflow] <0> No results for objective function IsNonExisting.NonExisting

Ruby:

[13:54:18.023960 WARN] runner.registerWarning called
[13:54:18.056100 WARN] No results for objective function IsNonExisting.NonExisting

Expected Behavior

Steps to Reproduce

1. 2. 3. 4.

Possible Solution

Details

Environment

Some additional details about your environment for this issue (if relevant):

Context

jmarrec commented 9 months ago

Given this call: LOG_FREE(Debug, "Channel", "MSG")

Current behavior:

# C++
[Channel] <-1> MSG
# Ruby's run.log
[11:12:13.123456 DEBUG] MSG

Proposed, when running a workflow:

# Proposed
# Stdout
[Channel] <Debug> MSG
# run.log
[11:12:13.123456 DEBUG] [Channel] MSG

Additional question: do we need a switch to use the old run.log format or just set the behavior?

thoughts please?

kbenne commented 9 months ago

I like the proposed format [11:12:13.123456 DEBUG] [Channel] MSG without a switch. Would that be ok for everyone? @shorowit @joseph-robertson