|
1 | | -# Copyright 2001-2013 by Vinay Sajip. All Rights Reserved. |
| 1 | +# Copyright 2001-2014 by Vinay Sajip. All Rights Reserved. |
2 | 2 | # |
3 | 3 | # Permission to use, copy, modify, and distribute this software and its |
4 | 4 | # documentation for any purpose and without fee is hereby granted, |
|
18 | 18 | Logging package for Python. Based on PEP 282 and comments thereto in |
19 | 19 | comp.lang.python. |
20 | 20 |
|
21 | | -Copyright (C) 2001-2013 Vinay Sajip. All Rights Reserved. |
| 21 | +Copyright (C) 2001-2014 Vinay Sajip. All Rights Reserved. |
22 | 22 |
|
23 | 23 | To use, simply 'import logging' and log away! |
24 | 24 | """ |
|
42 | 42 |
|
43 | 43 | __author__ = "Vinay Sajip <[email protected]>" |
44 | 44 | __status__ = "production" |
| 45 | +# The following module attributes are no longer updated. |
45 | 46 | __version__ = "0.5.1.2" |
46 | 47 | __date__ = "07 February 2010" |
47 | 48 |
|
@@ -902,8 +903,15 @@ def handleError(self, record): |
902 | 903 | sys.stderr.write('Logged from file %s, line %s\n' % ( |
903 | 904 | record.filename, record.lineno)) |
904 | 905 | # Issue 18671: output logging message and arguments |
905 | | - sys.stderr.write('Message: %r\n' |
906 | | - 'Arguments: %s\n' % (record.msg, record.args)) |
| 906 | + try: |
| 907 | + sys.stderr.write('Message: %r\n' |
| 908 | + 'Arguments: %s\n' % (record.msg, |
| 909 | + record.args)) |
| 910 | + except Exception: |
| 911 | + sys.stderr.write('Unable to print the message and arguments' |
| 912 | + ' - possible formatting error.\nUse the' |
| 913 | + ' traceback above to help find the error.\n' |
| 914 | + ) |
907 | 915 | except OSError: #pragma: no cover |
908 | 916 | pass # see issue 5971 |
909 | 917 | finally: |
|
0 commit comments