Current Path : /usr/lib/python2.7/dist-packages/twisted/python/ |
Current File : //usr/lib/python2.7/dist-packages/twisted/python/syslog.pyc |
ó [³XMc @ s] d Z e d ƒ Z d d l m Z d Z e j Z d d d „ ƒ YZ d e e d d „ Z d S( so Classes and utility functions for integrating Twisted and syslog. You probably want to call L{startLogging}. t syslogiÿÿÿÿ( t logi t SyslogObserverc B s8 e Z d Z e j Z e j Z e e d „ Z d „ Z RS( sU A log observer for logging to syslog. See L{twisted.python.log} for context. This logObserver will automatically use LOG_ALERT priority for logged failures (such as from C{log.err()}), but you can use any priority and facility by setting the 'C{syslogPriority}' and 'C{syslogFacility}' keys in the event dict. c C s | j | | | ƒ d S( sß @type prefix: C{str} @param prefix: The syslog prefix to use. @type options: C{int} @param options: A bitvector represented as an integer of the syslog options to use. @type facility: C{int} @param facility: An indication to the syslog daemon of what sort of program this is (essentially, an additional arbitrary metadata classification for messages sent to syslog by this observer). N( t openlog( t selft prefixt optionst facility( ( s9 /usr/lib/python2.7/dist-packages/twisted/python/syslog.pyt __init__# s c C s t j | ƒ } | d k r d St j } d } | d rD t j } n d | k rc t | d ƒ } n d | k r‚ t | d ƒ } n | j d ƒ } x! | d d g k r´ | j ƒ q” Wt } xI | D]A } | r× t } n d | } | j | | Bd | d | f ƒ q Wd S( s† Send a message event to the I{syslog}. @param eventDict: The event to send. If it has no C{'message'} key, it will be ignored. Otherwise, if it has C{'syslogPriority'} and/or C{'syslogFacility'} keys, these will be used as the syslog priority and facility. If it has no C{'syslogPriority'} key but a true value for the C{'isError'} key, the B{LOG_ALERT} priority will be used; if it has a false value for C{'isError'}, B{LOG_INFO} will be used. If the C{'message'} key is multiline, each line will be sent to the syslog separately. Ni t isErrort syslogPriorityt syslogFacilitys iÿÿÿÿt s s [%s] %st system( R t textFromEventDictt NoneR t LOG_INFOt LOG_ALERTt intt splitt popt Truet False( R t eventDictt textt priorityR t linest firstLinet line( ( s9 /usr/lib/python2.7/dist-packages/twisted/python/syslog.pyt emit5 s* ( t __name__t __module__t __doc__R R t DEFAULT_OPTIONSt DEFAULT_FACILITYR R ( ( ( s9 /usr/lib/python2.7/dist-packages/twisted/python/syslog.pyR s t Twistedi c C s, t | | | ƒ } t j | j d | ƒd S( s Send all Twisted logging output to syslog from now on. The prefix, options and facility arguments are passed to C{syslog.openlog()}, see the Python syslog documentation for details. For other parameters, see L{twisted.python.log.startLoggingWithObserver}. t setStdoutN( R R t startLoggingWithObserverR ( R R R R$ t obs( ( s9 /usr/lib/python2.7/dist-packages/twisted/python/syslog.pyt startLogginga s N( ( R t __import__R t twisted.pythonR R! t LOG_USERR"