-
Notifications
You must be signed in to change notification settings - Fork 78
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
Set info logging level in find_tailcuts #1349
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1349 +/- ##
==========================================
- Coverage 72.86% 72.86% -0.01%
==========================================
Files 137 137
Lines 14515 14516 +1
==========================================
Hits 10577 10577
- Misses 3938 3939 +1 ☔ View full report in Codecov by Sentry. |
In principle not, I think it should be controlled by the level set in the main script calling the other module (see example at the top of https://docs.python.org/3/library/logging.html). Maybe need to set explicitly the level for file handler as well. In def main():
args = parser.parse_args()
output_dir = args.output_dir.absolute()
output_dir.mkdir(exist_ok=True, parents=True)
log.setLevel(logging.INFO)
# Console handler
console_handler = logging.StreamHandler(sys.stdout)
console_handler.setLevel(logging.INFO)
logging.getLogger().addHandler(console_handler)
# File handler
log_file = args.log_file or f'log_find_tailcuts_Run{run_id:05d}.log'
log_file = output_dir / log_file
file_handler = logging.FileHandler(log_file, mode='w')
file_handler.setLevel(logging.INFO)
logging.getLogger().addHandler(file_handler)
... |
I will try, thanks a lot for the info! |
Adding the console handler resulted in duplication of the (incomplete) output in stdout. |
@morcuended I tried to follow the suggestions in the link you sent and did not help. The only way I seem to be able to activate INFO logging is inside cleaning.py |
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.
I do not know the reason why. It is still strange to me that it is not controlled by the main script calling the function.
Therefore, use the definition inside the function for the time being.
Not sure if there is a better way to set it (let me know if that is the case). Doing it in the script which calls the function did not work.