-
Notifications
You must be signed in to change notification settings - Fork 14
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 log filename from environment variable #702
Conversation
Codecov Report
@@ Coverage Diff @@
## main-dev #702 +/- ##
=========================================
Coverage 80.04% 80.04%
=========================================
Files 97 97
Lines 17432 17433 +1
=========================================
+ Hits 13953 13954 +1
Misses 3479 3479
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
pyaerocom/_logging.py
Outdated
from importlib import resources | ||
from logging.config import fileConfig | ||
|
||
LOGGING_CONFIG = dict( | ||
# root logger | ||
file_name="pyaerocom.log", | ||
file_name=os.getenv("PYAEROCOM_LOG_FILE", "pyaerocom.log"), |
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.
personally I would prefer to set the entire log file name via the env variable. Just like many command line tools support.
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.
you can provide full path on PYAEROCOM_LOG_FILE
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.
ups, I just realised that I did not understand the os.getenv
method. On the other hand the Python documentation mentions this syntax (which I find clearer): os.getenv(key, default=None)
Would you mind adding the default keyword?
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.
done
close #687