Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(9)

Side by Side Diff: Lib/logging/handlers.py

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/lib2to3/fixer_base.py ('k') | Lib/logging/__init__.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2001-2010 by Vinay Sajip. All Rights Reserved. 1 # Copyright 2001-2010 by Vinay Sajip. All Rights Reserved.
2 # 2 #
3 # Permission to use, copy, modify, and distribute this software and its 3 # Permission to use, copy, modify, and distribute this software and its
4 # documentation for any purpose and without fee is hereby granted, 4 # documentation for any purpose and without fee is hereby granted,
5 # provided that the above copyright notice appear in all copies and that 5 # provided that the above copyright notice appear in all copies and that
6 # both that copyright notice and this permission notice appear in 6 # both that copyright notice and this permission notice appear in
7 # supporting documentation, and that the name of Vinay Sajip 7 # supporting documentation, and that the name of Vinay Sajip
8 # not be used in advertising or publicity pertaining to distribution 8 # not be used in advertising or publicity pertaining to distribution
9 # of the software without specific, written prior permission. 9 # of the software without specific, written prior permission.
10 # VINAY SAJIP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 10 # VINAY SAJIP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 def mapPriority(self, levelName): 762 def mapPriority(self, levelName):
763 """ 763 """
764 Map a logging level name to a key in the priority_names map. 764 Map a logging level name to a key in the priority_names map.
765 This is useful in two scenarios: when custom levels are being 765 This is useful in two scenarios: when custom levels are being
766 used, and in the case where you can't do a straightforward 766 used, and in the case where you can't do a straightforward
767 mapping by lowercasing the logging level name because of locale- 767 mapping by lowercasing the logging level name because of locale-
768 specific issues (see SF #1524081). 768 specific issues (see SF #1524081).
769 """ 769 """
770 return self.priority_map.get(levelName, "warning") 770 return self.priority_map.get(levelName, "warning")
771 771
772 ident = '' # prepended to all messages
773 append_nul = True # some old syslog daemons expect a NUL terminator 772 append_nul = True # some old syslog daemons expect a NUL terminator
774 773
775 def emit(self, record): 774 def emit(self, record):
776 """ 775 """
777 Emit a record. 776 Emit a record.
778 777
779 The record is formatted, and then sent to the syslog server. If 778 The record is formatted, and then sent to the syslog server. If
780 exception information is present, it is NOT sent to the server. 779 exception information is present, it is NOT sent to the server.
781 """ 780 """
782 msg = self.format(record) 781 msg = self.format(record)
783 if self.ident:
784 msg = self.ident + msg
785 if self.append_nul: 782 if self.append_nul:
786 msg += '\000' 783 msg += '\000'
787 """ 784 """
788 We need to convert record level to lowercase, maybe this will 785 We need to convert record level to lowercase, maybe this will
789 change in the future. 786 change in the future.
790 """ 787 """
791 prio = '<%d>' % self.encodePriority(self.facility, 788 prio = '<%d>' % self.encodePriority(self.facility,
792 self.mapPriority(record.levelname)) 789 self.mapPriority(record.levelname))
793 prio = prio.encode('utf-8') 790 prio = prio.encode('utf-8')
794 # Message is a string. Convert to bytes as required by RFC 5424 791 # Message is a string. Convert to bytes as required by RFC 5424
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
1340 Stop the listener. 1337 Stop the listener.
1341 1338
1342 This asks the thread to terminate, and then waits for it to do so. 1339 This asks the thread to terminate, and then waits for it to do so.
1343 Note that if you don't call this before your application exits, ther e 1340 Note that if you don't call this before your application exits, ther e
1344 may be some records still left on the queue, which won't be processe d. 1341 may be some records still left on the queue, which won't be processe d.
1345 """ 1342 """
1346 self._stop.set() 1343 self._stop.set()
1347 self.enqueue_sentinel() 1344 self.enqueue_sentinel()
1348 self._thread.join() 1345 self._thread.join()
1349 self._thread = None 1346 self._thread = None
OLDNEW
« no previous file with comments | « Lib/lib2to3/fixer_base.py ('k') | Lib/logging/__init__.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+