techtonik / python-patch

Library to parse and apply unified diffs
https://pypi.python.org/pypi/patch
106 stars 63 forks source link

Patch: clean up when messages are printed #12

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The attached patch does a few things related to how/when messages are printed:

1. Changes the default loglevel when used as a library to WARN.  This is 
because since there's currently no other way for the caller to get any feedback 
about success/failure, it should at least default to a setting where somebody 
might notice if there's problems.  (Better to have the app developer have to 
explicitly turn off errors than have things fail silently by default)

2. Changes the "successfully patched..." message to INFO instead of WARN, since 
it's actually normal, not an error.

3. Adds a '--quiet' option to the command line, to suppress normal info 
messages if desired.

4. Changes the run_tests.py code to use the 'quiet' flag when invoking the 
patch.py program.  This is mainly just a cosmetic thing, but it gets rid of all 
the spammy messages from patch.py when running the test suite.

Original issue reported on code.google.com by foogod@gmail.com on 28 Aug 2010 at 2:29

Attachments:

GoogleCodeExporter commented 9 years ago
This issue was updated by revision r100.

2. Done

Original comment by techtonik@gmail.com on 29 Aug 2010 at 7:07

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r101.

Original comment by techtonik@gmail.com on 29 Aug 2010 at 8:57

GoogleCodeExporter commented 9 years ago
The logging is controlled by "python_patch" logger specifically for library 
usage. You can do logging.getLogger("python_patch").setLevel(logging.WARN) in 
your application. Perhaps the better solution would be to list library use 
cases where a success/failure feedback is desired with a preferred API.

Following your suggestion I've changed level for some messages to clean up 
output from test suite. Added --verbose instead of '-d' shortcut, some time ago 
'-d' was renamed to '--debug' when a need arised to add the same option for 
compatibility with unix patch in issue #7

Original comment by techtonik@gmail.com on 29 Aug 2010 at 9:03