ó
Cü½cc           @   s:   d  d l  Z  d  d l Z d d d „ Z d d d „ Z d S(   iÿÿÿÿNt    c         C   s?   t  j j d |  ƒ t j d t  j ƒ t  j j d | ƒ d  S(   Ns   Logging error: %s
t   files   Original log message:
%s
(   t   syst
   __stderr__t   writet	   tracebackt	   print_exc(   t   loggert   msg(    (    s4   /export/web/mailman/mailman/Mailman/Logging/Utils.pyt   _logexc   s    i   c         C   s§   d d l  m  } d d l m } yn | |  d | d | d d ƒ} | r} t t d ƒ rb t j } n	 t j } | | | ƒ } n  | t _ t j SWn t k
 r¢ d	 SXd	 S(
   sß   Establish a StampedLogger on sys.stderr if possible.

    If tee_to_real_stderr is true, then the real standard error also gets
    output, via a MultiLogger.

    Returns the MultiLogger if successful, None otherwise.
    iÿÿÿÿ(   t   StampedLogger(   t   MultiLoggert   labelt   manual_reprimet   nofaili    R   N(   R
   R   t   hasattrR   R   t   stderrt   IOErrort   None(   t   categoryR   R   t   tee_to_real_stderrR
   R   R   R   (    (    s4   /export/web/mailman/mailman/Mailman/Logging/Utils.pyt	   LogStdErr   s     				(   R   R   R   R	   R   (    (    (    s4   /export/web/mailman/mailman/Mailman/Logging/Utils.pyt   <module>   s   