mò ÔDc@sTdZdgZdkZdkZdkZdkTdefd„ƒYZeƒZ dS(s9Logging support for getmail. The new standard Python libary module logging didn't cut it for me; it doesn't seem capable of handling some very simple requirements like logging messages of a certain level to one fd, and other messages of higher levels to a different fd (i.e. info to stdout, warnings to stderr). tLoggerN(t*t_LoggercBs€tZdZd„Zd„Zed„Zd„Zd„Zdd„Z d„Z d „Z d „Z d „Z d „Zd „ZRS(siClass for logging. Do not instantiate directly; use Logger() instead, to keep this a singleton. cCsg|_t|_dS(sCreate a logger.N(tselfthandlerstFalsetnewline(R((t7/usr/lib/python2.4/site-packages/getmailcore/logging.pyt__init__s cCs|S(N(R(R((Rt__call__scCs8|iihd|<d|<dt<d|<ƒdS(sAdd a handler for logged messages. Logged messages of at least level (and at most level , default CRITICAL) will be output to . If no handlers are specified, messages of all levels will be output to stdout. tminleveltstreamRtmaxlevelN(RRtappendR R tTrueR (RR R R ((Rt addhandler!scCs g|_dS(sÃClear the list of handlers. There should be a way to remove only one handler from a list. But that would require an easy way for the caller to distinguish between them. N(RR(R((Rt clearhandlers-scCs3x¯|iD]¤}||djp||djoq n|d o"|tjo|didƒn|di|ƒ|diƒ|idƒot |d containing text .R R RR s N(RRthandlertmsgleveltDEBUGtwritetmsgtxttflushtendswithRRRtsyststdout(RRRR((Rtlog5s( "   strace cCsVtiƒd}d|tdtii|tƒ|t|f}|i t |ƒdS(s™Log a message with level TRACE. The message will be prefixed with filename, line number, and function name of the calling code. işÿÿÿs %s [%s:%i] %ss()N( t tracebackt extract_stackttracetFUNCNAMEtostpathtbasenametFILENAMEtLINENOtmsgRRtTRACE(RR$R((RRLs2cCs|it|ƒdS(sLog a message with level DEBUG.N(RRRR$(RR$((RtdebugZscCs|it|ƒdS(s"Log a message with level MOREINFO.N(RRtMOREINFOR$(RR$((Rtmoreinfo^scCs|it|ƒdS(sLog a message with level INFO.N(RRtINFOR$(RR$((RtinfobscCs|it|ƒdS(s!Log a message with level WARNING.N(RRtWARNINGR$(RR$((RtwarningfscCs|it|ƒdS(sLog a message with level ERROR.N(RRtERRORR$(RR$((RterrorjscCs|it|ƒdS(s"Log a message with level CRITICAL.N(RRtCRITICALR$(RR$((Rtcriticalns(t__name__t __module__t__doc__RR R/RRRRR&R(R*R,R.R0(((RRs           ( R3t__all__Rtos.pathRRtgetmailcore.constantstobjectRR(R4RRRRR((Rt?s    ]