-
Notifications
You must be signed in to change notification settings - Fork 8
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
logging: add config for trace loggers and logging directory #118
Conversation
0847c18
to
7001b7f
Compare
Codecov Report
@@ Coverage Diff @@
## main #118 +/- ##
==========================================
- Coverage 70.90% 70.28% -0.63%
==========================================
Files 33 33
Lines 1619 1669 +50
Branches 199 207 +8
==========================================
+ Hits 1148 1173 +25
- Misses 439 461 +22
- Partials 32 35 +3
Continue to review full report at Codecov.
|
fc3611c
to
97f349a
Compare
- allow configuring loggers and their specified levels Some loggers can get spammy when debugging, this allows turning them down, or setting other loggers to lower levels than the root To use, set a MODMAIL_{level}_LOGGERS environment variable, delimiting the loggers with `,` Valid levels are all of the valid levels for logging, as follows trace, debug, info, notice, warning, error, critical - add support for configuring the file logging directory The directory for logging files was fully dependent on the current working directory This caused my environment to be littered with logging directories The solution to this was to continue to use the current working directory, unless the parent directory of the bot is also a parent of the cwd, in which case the bot parent directory is used for creating the logging directory. In addition, `MODMAIL_LOGGING_DIRECTORY` has been added as an override environment variable. Setting it will use that directory for logging.
97f349a
to
9c40668
Compare
modmail/log.py
Outdated
This is applied for every logging level. | ||
""" | ||
env_vars = _get_env() | ||
fmt_key = "MODMAIL_{level}_LOGGERS" |
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.
TBH I'm not sure if this should be this format, or if MODMAIL_LOGGERS_{level}
makes more sense since the variable is now more hierarchical.
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'm going to reverse this format, actually.
Some loggers can get spammy when debugging, this allows
turning them down, or setting other loggers to lower levels than the root
To use, set a MODMAIL_{level}_LOGGERS environment variable, delimiting
the loggers with
,
Valid levels are all of the valid levels for logging, as follows
trace, debug, info, notice, warning, error, critical
The directory for logging files was fully dependent on the current
working directory
This caused my environment to be littered with logging directories
The solution to this was to continue to use the current working
directory, unless the parent directory of the bot is also a parent of
the cwd, in which case the bot parent directory is used for creating
the logging directory.
In addition,
MODMAIL_LOGGING_DIRECTORY
has been added as an overrideenvironment variable. Setting it will use that directory for logging.