-
Notifications
You must be signed in to change notification settings - Fork 890
Description
In https://github.com/Pylons/pyramid/blob/master/src/pyramid/scripts/pserve.py#L146
The script outputs everything to the stderr file descriptor. If you redirect the stdout and stderr stream to your logger, then for example the 'Starting server' message gets logged as an error.
I would propose to split the out function into two in PServeCommand:
def out(self, msg): # pragma: no cover
if self.args.verbose > 0:
print(msg)
def out_err(self, msg): # pragma: no cover
if self.args.verbose > 0:
print(msg, file=sys.stderr)
And call the out_err function to print 'You must give a config file'.
In the rest of the file all of the other prints could also be changed to stdout, so that hey would no longer output starting/serving messages to stderr.
In other scripts even errors get printed to stdout, so this could also be applied in other scripts where applicable: https://github.com/Pylons/pyramid/blob/master/src/pyramid/scripts/prequest.py#L135
I can create a PR if such a changes would be permitted.