-
Notifications
You must be signed in to change notification settings - Fork 518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Preformatted
class for logging preformatted messages
#2998
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #2998 +/- ##
==========================================
+ Coverage 87.85% 88.08% +0.22%
==========================================
Files 769 769
Lines 89497 89507 +10
==========================================
+ Hits 78632 78838 +206
+ Misses 10865 10669 -196
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lovely and elegant solution. Minor grammar weirdness.
Preformatted
class for logging preformatted messages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Fixes # .
Summary/Motivation:
MindtPy and PyROS both want to emit solver iteration logs and do NOT want those messages to be reformatted or line-wrapped. Their current solution is to hijack the entire Pyomo logging system to suppress the automatic formatting that the default log handler implements. This PR simplifies that by defining a
Preformatted
class that users can wrap a preformatted log message in before sending it to the logger. These messages will then be directly emitted (without being processed by the default formatter). AsPreformatted
is castable tostr
, it is compatible with other user-defined log handlers / formatters (without requiring any specialized handling).Changes proposed in this PR:
Preformatted
wrapper class for logging preformatted messagesLegal Acknowledgement
By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution: