-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[core] Setup logger to be able to use logging in plugins #2845
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
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #2845 +/- ##
===========================================
+ Coverage 77.79% 79.02% +1.22%
===========================================
Files 50 51 +1
Lines 6725 6856 +131
===========================================
+ Hits 5232 5418 +186
+ Misses 1493 1438 -55 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
0eed292 to
01c3d2e
Compare
5cf7459 to
1962ed0
Compare
|
I would like to simply it a bit more, like this: import logging
def print_info():
logging.info (f"Message with info level ({logger})")
logging.warning(f"Message with warning level ({logger})")
logging.error (f"Message with error level ({logger})")
class TestNode2(desc.Node):
def processChunk(self, chunk):
logging.getLogger().setLevel(chunk.node.verboseLevel.value.upper())
print_info()So if we call any 3rd party python code, the logging behavior will be correct. And maybe in another PR, move the verbose param as a default param, so we can configure it by default. |
1962ed0 to
7d27047
Compare
Actually I tested and with the code you provided it works already
You mean as an internalInput ? |
Yes |
37b551a to
951f46e
Compare
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.
Pull Request Overview
This PR introduces comprehensive logging infrastructure improvements to enable plugins to use Python's standard logging module alongside the existing chunk-based logging system. The main goal is to expand logging capabilities beyond just chunk processing to support broader node-level and plugin logging.
- Refactors the LogManager class to work with any logger and log file, not just chunks
- Adds a new trace logging level below debug for more granular debugging
- Introduces prepareLogger/restoreLogger methods on nodes for setting up root logger configuration
- Adds a new internal input parameter for configuring default node logging levels
Reviewed Changes
Copilot reviewed 5 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_compute.py | Comprehensive test suite for the new logging functionality with chunked and non-chunked nodes |
| meshroom/core/nodeFactory.py | Prevents conflicts between user inputs and internal inputs by filtering duplicates |
| meshroom/core/node.py | Major refactoring of LogManager and addition of node-level logging methods |
| meshroom/core/desc/node.py | Adds new nodeDefaultLoglevel internal parameter for configuring logging levels |
| meshroom/init.py | Implements custom TRACE logging level and updates logging level mappings |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
951f46e to
c6c8417
Compare
cbentejac
left a comment
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.
Everything works as expected, the requested changes are mostly cosmetic.
| # The line below can cause UI issues but at least prevent crashes | ||
| internalInputs = {k: v for k, v in self.internalInputs.items() if k not in self.inputs.keys()} |
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.
Is this necessary, since the internal input for the logger doesn't have (and isn't likely to ever have) the same name as an input parameter?
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.
It shouldn't be necessary, but I still think this is better to have this protection, because having twice the same keyword arg in the call of Node(...) will always raise an error.
c6c8417 to
52c4e91
Compare
7ddb38b to
0529cc1
Compare
Description
prepareLoggerandrestoreLoggeron the node, that can be used to setup and restore the root loggerLogManagerto handle more than only the chunksNow here's how we can use it
chunk.logger(previous way)logging