NatLabRockies / NatLabRockies/OpenStudio
[refactor] Assess the Logger situation and eliminate inefficiency
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 646
- Forks
- 237
- Avg merge
- 3d 11h
- Merged PRs (30d)
- 10
Description
Enhancement Request
Eliminate the use of StringStreamLogSink
* The use of a `StringStreamSinkLogSink`, for eg for EnergyPlus ForwardTranslator and then **regex parsing** that to derive logMessages is an abomination that should be eliminated.
Detailed Description
Regex parsing is slow, and expensive.
It also poses an extensibility/customization issue: If changing the formatter (the format of the log messages), the parseLogText gets thrown out the window.
Possible Implementation
- The use of a pattern similar to the one I used in XMLValidator is a possibility
- Write our end backend sink and override consume to emplace LogMessages is probably the sanest option
Other issues
- We use a synchronized_feeding backend sink, I think we may need a concurrent_feeding one
- It seems like we may be misusing mutexes.
- This is confusing naming: https://github.com/NREL/OpenStudio/blob/dc35f3e81b01950aae134986e4bdb31e6fc18b22/src/utilities/core/LogMessage.hpp#L43
- boost::log::sinks::synchronous_sink is a frontend sink
- boost::log::sinks::text_ostream_backend is the backend
Context
List of references:
- Ref #3912
- Especially this commit message: https://github.com/NREL/OpenStudio/pull/3912/commits/41430bd72ff498fb7761afcceea20dd12ca58467
- Ref #5030
- ref #5037
- Ref comments on https://github.com/NREL/OpenStudio/pull/5035#pullrequestreview-1732453420
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading src/utilities/core/LogMessage.hpp and tracing the StringStreamLogSink uses described for the EnergyPlus ForwardTranslator, then compare the XMLValidator pattern and the Boost sink references. Done means agreeing on and implementing a logging path that avoids regex parsing, while addressing the stated sink, concurrency, mutex, and naming concerns.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100