;ς
	ό?c           @   s»   d  Z  d k Z d k Z d k Z d k Z d k Z d k Z d k Z d k Z d k	 Z	 d k
 l Z l Z d Z e i d j o
 d Z n d Z e a e d  Z e d  Z d	   Z d S(
   sb  
Logging package for Python. Based on PEP 282 and comments thereto in
comp.lang.python, and influenced by Apache's log4j system.

Should work under Python versions >= 1.5.2, except that source line
information is not available unless 'inspect' is.

Copyright (C) 2001-2002 Vinay Sajip. All Rights Reserved.

To use, simply 'import logging' and log away!
N(   s   ThreadingTCPServers   StreamRequestHandleriF#  s   win32iF'  ih   c   !      C   s'  d k  } | i  |  } t | d  o t |  d  o | i |   n | i |   | i d d  } t	 |  oΊ t
 i | d  } h  } x | D] } d | } | i |  } d | j o | i | d d	  } n t } d
 | j o | i | d
 d	  }	 n t }	 t i | |	  } | | | <q Wn t i   zάyt i i   | i d d  } t	 |  oΟt
 i | d  } h  } g  } xt| D]l} d | } | i | d  } | i |  } d | j o | i | d  } n d } t  | t! t   } | i | d  } t  | t! t   } t# | |  } d | j o* | i | d  } | i& t i' |  n t	 |  o | i( | |  n | t i i) j oQ d | j o | i | d  } n d } t	 |  o | i+ | | f  qςn | | | <qWx7 | D]+ } | d } | d	 } | i. | |  qWn | i d d  } t
 i | d  } | i0 d  d } t i1 } | } | i |  } d | j o* | i | d  } | i& t i' |  n x | i D] } | i3 |  qΡW| i | d  } t	 |  o8 t
 i | d  } x# | D] } | i4 | |  q Wn | i5 i6 i7   } xQ| D]I} d | } | i | d  }  | i |  } d | j o | i: | d  } n d	 } t i< |   }
 |  | j o | i0 |   n d | j o* | i | d  } |
 i& t i' |  n x |
 i D] } |
 i3 |  q!W| |
 _; d |
 _> | i | d  } t	 |  o8 t
 i | d  } x# | D] } |
 i4 | |  qWqXqXWx! | D] } d	 | i5 i6 | _> q¬WWnG d k? } t@ iA   } | iC | d | d	 | d t t@ iD  ~ n XWd t iE   Xd S(   s5  
    Read the logging configuration from a ConfigParser-format file.

    This can be called several times from an application, allowing an end user
    the ability to select from various pre-canned configurations (if the
    developer provides a mechanism to present the choices and load the chosen
    configuration).
    In versions of ConfigParser which have the readfp method [typically
    shipped in 2.x versions of Python], you can pass in a file-like object
    rather than a filename, in which case the file-like object will be read
    using readfp.
    Ns   readfps   readlines
   formatterss   keyss   ,s   formatter_%ss   formati   s   datefmts   handlerss
   handler_%ss   classs	   formatters    s   argss   levels   targeti    s   loggerss   roots   logger_roots	   logger_%ss   qualnames	   propagatei   (F   s   ConfigParsers   defaultss   cps   hasattrs   fnames   readfps   reads   gets   flists   lens   strings   splits
   formatterss   forms   sectnames   optionss   optss   fss   Nones   dfss   loggings	   Formatters   fs   _acquireLocks	   _handlerss   clears   hlists   handlerss   fixupss   hands   klasss   fmts   evals   varss   argss   applys   hs   levels   setLevels   _levelNamess   setFormatters   MemoryHandlers   targets   appends   fixups   ts	   setTargets   llists   removes   roots   logs   removeHandlers
   addHandlers   managers
   loggerDicts   keyss   existings   qns   getints	   propagates	   getLoggers   loggers   disableds	   tracebacks   syss   exc_infos   eis   print_exceptions   stderrs   _releaseLock(!   s   fnames   defaultss	   tracebacks   eis   existings   cps   fixups   logs   fmts   dfss   loggers   fixupss   ts   fss   forms   argss   flists	   propagates   hlists   hands   ConfigParsers   sectnames   levels   targets   fs   hs   handlerss
   formatterss   llists   klasss   roots   optss   qn(    (    s+   /mit/python/lib/python2.3/logging/config.pys
   fileConfig/   sζ     	  

 
 

	  
 
 		  	( c         C   sm   t  o t d  n d t f d     Y} d t f d     Y} d   } t i d | d | | |  f  Sd	 S(
   sW  
    Start up a socket server on the specified port, and listen for new
    configurations.

    These will be sent as a file suitable for processing by fileConfig().
    Returns a Thread object on which you can call start() to start the server,
    and which you can join() when appropriate. To stop the server, call
    stopListening().
    s    listen() needs threading to works   ConfigStreamHandlerc           B   s   t  Z d  Z d   Z RS(   s€   
        Handler for a logging configuration request.

        It expects a completely new logging configuration and uses fileConfig
        to install it.
        c   	      C   sH  d k  } yί |  i } | i d  } t |  d j o° t i d |  d } |  i i |  } x5 t |  | j  o! | | i | t |   } qb W| i
 d  } t | d  } | i |  | i   t |  t i |  n WnY t i j
 oJ } t | i  t i j o   qD| i d } | t j o   qDn Xd S(   sΕ   
            Handle a request.

            Each request is expected to be a 4-byte length,
            followed by the config file. Uses fileConfig() to do the
            grunt work.
            Ni   s   >Li    s   .inis   w(   s   tempfiles   selfs
   connections   conns   recvs   chunks   lens   structs   unpacks   slens   mktemps   files   opens   fs   writes   closes
   fileConfigs   oss   removes   sockets   errors   es   types   argss   typess	   TupleTypes   errcodes   RESET_ERROR(	   s   selfs   slens   fs   tempfiles   errcodes   files   es   chunks   conn(    (    s+   /mit/python/lib/python2.3/logging/config.pys   handleΦ   s.     		 "

(   s   __name__s
   __module__s   __doc__s   handle(    (    (    s+   /mit/python/lib/python2.3/logging/config.pys   ConfigStreamHandlerΟ   s    s   ConfigSocketReceiverc           B   s/   t  Z d  Z d Z d e e d  Z d   Z RS(   sD   
        A simple TCP socket-based logging config receiver.
        i   s	   localhostc         C   sC   t  i |  | | f |  t i   d |  _ t i	   d |  _
 d  S(   Ni    i   (   s   ThreadingTCPServers   __init__s   selfs   hosts   ports   handlers   loggings   _acquireLocks   aborts   _releaseLocks   timeout(   s   selfs   hosts   ports   handler(    (    s+   /mit/python/lib/python2.3/logging/config.pys   __init__  s
    
	
c         C   s   d  k  } d } xo | of | i  |  i i   g g  g  |  i  \ } } } | o |  i	   n t
 i   |  i } t
 i   q Wd  S(   Ni    (   s   selects   aborts   selfs   sockets   filenos   timeouts   rds   wrs   exs   handle_requests   loggings   _acquireLocks   _releaseLock(   s   selfs   rds   aborts   wrs   selects   ex(    (    s+   /mit/python/lib/python2.3/logging/config.pys   serve_until_stopped	  s    	 
	(   s   __name__s
   __module__s   __doc__s   allow_reuse_addresss   DEFAULT_LOGGING_CONFIG_PORTs   Nones   __init__s   serve_until_stopped(    (    (    s+   /mit/python/lib/python2.3/logging/config.pys   ConfigSocketReceiverϊ   s    c         C   s=   |  d | d |  } t i   | a t i   | i   d  S(   Ns   ports   handler(	   s   rcvrs   ports   hdlrs   servers   loggings   _acquireLocks	   _listeners   _releaseLocks   serve_until_stopped(   s   rcvrs   hdlrs   ports   server(    (    s+   /mit/python/lib/python2.3/logging/config.pys   serve  s     

s   targets   argsN(
   s   threads   NotImplementedErrors   StreamRequestHandlers   ConfigStreamHandlers   ThreadingTCPServers   ConfigSocketReceivers   serves	   threadings   Threads   port(   s   ports   ConfigSocketReceivers   serves   ConfigStreamHandler(    (    s+   /mit/python/lib/python2.3/logging/config.pys   listenΒ   s    	 +	c           C   s2   t  o' t i   d t  _ t a  t i   n d S(   sN   
    Stop the listening server which was created with a call to listen().
    i   N(   s	   _listeners   loggings   _acquireLocks   aborts   Nones   _releaseLock(    (    (    s+   /mit/python/lib/python2.3/logging/config.pys   stopListening"  s      
	(   s   __doc__s   syss   loggings   logging.handlerss   strings   threads	   threadings   sockets   structs   oss   SocketServers   ThreadingTCPServers   StreamRequestHandlers   DEFAULT_LOGGING_CONFIG_PORTs   platforms   RESET_ERRORs   Nones	   _listeners
   fileConfigs   listens   stopListening(   s   listens   loggings   strings   threads   StreamRequestHandlers   structs   syss	   threadings   RESET_ERRORs
   fileConfigs   DEFAULT_LOGGING_CONFIG_PORTs   oss   stopListenings   ThreadingTCPServers   socket(    (    s+   /mit/python/lib/python2.3/logging/config.pys   ?   s   Q
`