-
Notifications
You must be signed in to change notification settings - Fork 298
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
Log messages to stdout instead of stderr #334
Conversation
pypiserver/__main__.py
Outdated
@@ -20,7 20,7 @@ | |||
|
|||
|
|||
def init_logging(level=None, frmt=None, filename=None): | |||
logging.basicConfig(level=level, format=frmt) | |||
logging.basicConfig(level=level, format=frmt, stream=sys.stdout) |
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.
Great, could you make it also optional and possible to specify from the configuration? Thanks!
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.
Thanks for this patch! This was a good catch, and I like the direction. I have a few thoughts about ways we might be able to improve the logging experience a bit more. Let me know what you think!
@@ -94,10 101,6 @@ def usage(): | |||
-v | |||
Enable verbose logging; repeat for more verbosity. | |||
|
|||
--log-conf <FILE> | |||
read logging configuration from FILE. | |||
By default, configuration is read from `log.conf` if found in server's dir. |
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.
Great catch! We must've forgotten to remove this at some point in the past
pypiserver/__main__.py
Outdated
@@ -117,6 120,9 @@ def usage(): | |||
A format-string selecting Http-Error properties to log; set to '%s' to see them all. | |||
[Default: %(body)s: %(exception)s \n%(traceback)s] | |||
|
|||
--log-to-stdout | |||
log messages to stdout instead of the default stderr |
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.
Since we're touching this, it might be better to give people some more configurability with this, for example:
--log-to-stream
Log messages to the specified stream. Valid values are "stdout", "stderr", or "none"
That way people can turn off string logging altogether if they want. With your refactor to the init_logging
function, this should be pretty easy to add in. What do you think?
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.
Sounds good. I've added it to the PR. I've renamed it to log-stream
to be more consistent with the log-file
option
Co-authored-by: Matthew Planchard <[email protected]>
It took me a while to notice that the pipeline was failing, but it is fixed now. |
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.
This looks good to me! Thanks very much for the contribution, and feel free to join us on zulip
fixes #328