Lc#@sdZddddddddd d d d d ddddddddddddddddddd d!d"d#g#Zd$d%kZd$d%kZd$d%kZd$d%kZd$d%kZd$d%kZd$d%kZyd$d%k Z Wne j o d%Z nXyd$d%k Z d$d%k Z Wne j o d%Z nXd&Zd'Zd(Zd)Zeed*od+eied,fZn3eied,d_joed, d/ZneZeiieZd0Zeed1o d2ZneiZd3Zd3Zd3Zd3Zd4ZeZ d5Z!d6Z"e"Z#d7Z$d8Z%d9Z&h de6de!6de"6d e$6de%6de&6ed6e!d6e"d6e"d6e$d 6e%d6e&d6Z'd:Z(d;Z)e oe i*Z+nd%Z+d<Z,d=Z-d d`d>YZ.d?Z/d dad@YZ0e0Z1ddbdAYZ2ddcdBYZ3dCdddDYZ4hZ5gZ6d e4fdEYZ7de7fdFYZ8de8fdGYZ9dHdedIYZ:d%a;dJZ<dKZ=dLdfdMYZ>d e4fdNYZ?dOe?fdPYZ@e?a;ddgdQYZAe@e"ZBeBe?_Be>e?iBe?_CdRZDdSZEd%dTZFdUZGeGZHdVZIdWZJdXZKeKZLdYZMdZZNd[ZOd\ZPe6d]ZQyd$d%kRZReRiSeQWn+e j oeiTd^ZUeUe_TnXd%S(hs Logging package for Python. Based on PEP 282 and comments thereto in comp.lang.python, and influenced by Apache's log4j system. Copyright (C) 2001-2010 Vinay Sajip. All Rights Reserved. To use, simply 'import logging' and log away! t BASIC_FORMATtBufferingFormattertCRITICALtDEBUGtERRORtFATALt FileHandlertFiltert FormattertHandlertINFOt LogRecordtLoggert LoggerAdaptertNOTSETt StreamHandlertWARNtWARNINGt addLevelNamet basicConfigtcriticaltdebugtdisableterrort exceptiontfatalt getLevelNamet getLoggertgetLoggerClasstinfotlogt makeLogRecordtsetLoggerClasstwarntwarningiNs&Vinay Sajip t productions0.5.0.5s17 February 2009tfrozenslogging%s__init__%sis.pycs.pyos.pycCs"y tWntiiiSXdS(s5Return the frame object for the caller's stack frame.N(t Exceptiontsyst exc_tracebackttb_frametf_back(((s(/usr/lib64/python2.6/logging/__init__.pyt currentframeEs t _getframecCs tidS(i(R&R+(((s(/usr/lib64/python2.6/logging/__init__.pytLsii2i(iii icCsti|d|S(s Return the textual representation of logging level 'level'. If the level is one of the predefined levels (CRITICAL, ERROR, WARNING, INFO, DEBUG) then you get the corresponding string. If you have associated levels with names using addLevelName then the name you have associated with 'level' is returned. If a numeric value corresponding to one of the defined levels is passed in, the corresponding string representation is returned. Otherwise, the string "Level %s" % level is returned. sLevel %s(t _levelNamestget(tlevel((s(/usr/lib64/python2.6/logging/__init__.pyRscCs.tz|t|<|t|(R:RBRCRPR;(Re((s(/usr/lib64/python2.6/logging/__init__.pyt__str__%scCsttdpt|i}n_|i}t|titifjo6yt|i}Wqtj o|i}qXn|io||i}n|S(s Return the message for this LogRecord. Return the message for this LogRecord after merging any user-supplied arguments with the message. t UnicodeType( RcR>tstrR;R=Rkt StringTypet UnicodeErrorR@(ReR;((s(/usr/lib64/python2.6/logging/__init__.pyt getMessage)s  N(t__name__t __module__t__doc__RNRiRjRo(((s(/usr/lib64/python2.6/logging/__init__.pyR s  B c Cs5tdddddddd}|ii||S(s Make a LogRecord whose attributes are defined by the specified dictionary, This function is useful for converting a logging event received over a socket connection (which is sent as a dictionary) into a LogRecord instance. tiN((R RNt__dict__tupdate(tdicttrv((s(/usr/lib64/python2.6/logging/__init__.pyR=s!cBsDeZdZeiZdddZddZdZ dZ RS(s Formatter instances are used to convert a LogRecord to text. Formatters need to know how a LogRecord is constructed. They are responsible for converting a LogRecord to (usually) a string which can be interpreted by either a human or an external system. The base Formatter allows a formatting string to be specified. If none is supplied, the default value of "%s(message)\n" is used. The Formatter can be initialized with a format string which makes use of knowledge of the LogRecord attributes - e.g. the default value mentioned above makes use of the fact that the user's message and arguments are pre- formatted into a LogRecord's message attribute. Currently, the useful attributes in a LogRecord are described by: %(name)s Name of the logger (logging channel) %(levelno)s Numeric logging level for the message (DEBUG, INFO, WARNING, ERROR, CRITICAL) %(levelname)s Text logging level for the message ("DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL") %(pathname)s Full pathname of the source file where the logging call was issued (if available) %(filename)s Filename portion of pathname %(module)s Module (name portion of filename) %(lineno)d Source line number where the logging call was issued (if available) %(funcName)s Function name %(created)f Time when the LogRecord was created (time.time() return value) %(asctime)s Textual time when the LogRecord was created %(msecs)d Millisecond portion of the creation time %(relativeCreated)d Time in milliseconds when the LogRecord was created, relative to the time the logging module was loaded (typically at application startup time) %(thread)d Thread ID (if available) %(threadName)s Thread name (if available) %(process)d Process ID (if available) %(message)s The result of record.getMessage(), computed just as the record is emitted cCs*|o ||_n d|_||_dS(s8 Initialize the formatter with specified format strings. Initialize the formatter either with the specified format string, or a default as described above. Allow for specialized date formatting with the optional datefmt argument (if omitted, you get the ISO8601 format). s %(message)sN(t_fmttdatefmt(RetfmtRy((s(/usr/lib64/python2.6/logging/__init__.pyRixs  cCsX|i|i}|oti||}n&tid|}d||if}|S(s Return the creation time of the specified LogRecord as formatted text. This method should be called from format() by a formatter which wants to make use of a formatted time. This method can be overridden in formatters to provide for any specific requirement, but the basic behaviour is as follows: if datefmt (a string) is specified, it is used with time.strftime() to format the creation time of the record. Otherwise, the ISO8601 format is used. The resulting string is returned. This function uses a user-configurable function to convert the creation time to a tuple. By default, time.localtime() is used; to change this for a particular formatter instance, set the 'converter' attribute to a function with the same signature as time.localtime() or time.gmtime(). To change it for all formatters, for example if you want all logging times to be shown in GMT, set the 'converter' attribute in the Formatter class. s%Y-%m-%d %H:%M:%Ss%s,%03d(t converterRRR9tstrftimeRT(RetrecordRyRgtstt((s(/usr/lib64/python2.6/logging/__init__.pyt formatTimes cCsjti}ti|d|d|dd||i}|i|ddjo|d }n|S(s Format and return the specified exception information as a string. This default implementation just uses traceback.print_exception() iiiis N(t cStringIOtStringIOt tracebacktprint_exceptionRNtgetvaluetclose(ReteitsioR~((s(/usr/lib64/python2.6/logging/__init__.pytformatExceptions %  cCs|i|_ti|iddjo|i||i|_n|i|i}|i o'|i p|i |i |_ qn|i of|ddjo|d}ny||i }Wqt j o#||i i ti}qXn|S(s[ Format the specified record as text. The record's attribute dictionary is used as the operand to a string formatting operation which yields the returned string. Before formatting the dictionary, a couple of preparatory steps are carried out. The message attribute of the record is computed using LogRecord.getMessage(). If the formatting string contains "%(asctime)", formatTime() is called to format the event time. If there is exception information, it is formatted using formatException() and appended to the message. s %(asctime)iis (RotmessagetstringtfindRxRRytasctimeRtRMRORRntdecodeR&tgetfilesystemencoding(ReR}R~((s(/usr/lib64/python2.6/logging/__init__.pytformats    %N( RpRqRrR9t localtimeR{RNRiRRR(((s(/usr/lib64/python2.6/logging/__init__.pyRLs (   cBs5eZdZddZdZdZdZRS(sB A formatter suitable for formatting a number of records. cCs!|o ||_n t|_dS(sm Optionally specify a formatter which will be used to format each individual record. N(tlinefmtt_defaultFormatter(ReR((s(/usr/lib64/python2.6/logging/__init__.pyRis cCsdS(sE Return the header string for the specified records. Rs((Retrecords((s(/usr/lib64/python2.6/logging/__init__.pyt formatHeaderscCsdS(sE Return the footer string for the specified records. Rs((ReR((s(/usr/lib64/python2.6/logging/__init__.pyt formatFooterscCsnd}t|djoQ||i|}x$|D]}||ii|}q3W||i|}n|S(sQ Format the specified records and return the result as a string. Rsi(R<RRRR(ReRRwR}((s(/usr/lib64/python2.6/logging/__init__.pyRsN(RpRqRrRNRiRRR(((s(/usr/lib64/python2.6/logging/__init__.pyRs   cBs#eZdZddZdZRS(s Filter instances are used to perform arbitrary filtering of LogRecords. Loggers and Handlers can optionally use Filter instances to filter records as desired. The base filter class only allows events which are below a certain point in the logger hierarchy. For example, a filter initialized with "A.B" will allow events logged by loggers "A.B", "A.B.C", "A.B.C.D", "A.B.D" etc. but not "A.BB", "B.A.B" etc. If initialized with the empty string, all events are passed. RscCs||_t||_dS(s Initialize a filter. Initialize with the name of the logger which, together with its children, will have its events allowed through the filter. If no name is specified, allow every event. N(R:R<tnlen(ReR:((s(/usr/lib64/python2.6/logging/__init__.pyRi s cCsn|idjodS|i|ijodSti|i|id|idjodS|i|idjS(s Determine if the specified record is to be logged. Is the specified record to be logged? Returns 0 for no, nonzero for yes. If deemed appropriate, the record may be modified in-place. iit.(RR:RR(ReR}((s(/usr/lib64/python2.6/logging/__init__.pytfilters((RpRqRrRiR(((s(/usr/lib64/python2.6/logging/__init__.pyRs  tFilterercBs2eZdZdZdZdZdZRS(s[ A base class for loggers and handlers which allows them to share common code. cCs g|_dS(sE Initialize the list of filters to be an empty list. N(tfilters(Re((s(/usr/lib64/python2.6/logging/__init__.pyRi*scCs(||ijo|ii|ndS(s; Add the specified filter to this handler. N(Rtappend(ReR((s(/usr/lib64/python2.6/logging/__init__.pyt addFilter0scCs(||ijo|ii|ndS(s@ Remove the specified filter from this handler. N(Rtremove(ReR((s(/usr/lib64/python2.6/logging/__init__.pyt removeFilter7scCs9d}x,|iD]!}|i|p d}PqqW|S(s Determine if a record is loggable by consulting all the filters. The default is to allow the record to be logged; any filter can veto this and the record is then dropped. Returns a zero value if a record is to be dropped, else non-zero. ii(RR(ReR}Rwtf((s(/usr/lib64/python2.6/logging/__init__.pyR>s  (RpRqRrRiRRR(((s(/usr/lib64/python2.6/logging/__init__.pyR%s    cBs}eZdZedZdZdZdZdZdZ dZ dZ d Z d Z d Zd ZRS( sq Handler instances dispatch logging events to specific destinations. The base handler class. Acts as a placeholder which defines the Handler interface. Handlers can optionally use Formatter instances to format records as desired. By default, no formatter is specified; in this case, the 'raw' message as determined by record.message is logged. cCs]ti|||_d|_tzdt|twritet isinstancetunicodetgetattrRNRRtUnicodeEncodeErrortencodeRnRtKeyboardInterruptt SystemExitR(ReR}R;Rtfs((s(/usr/lib64/python2.6/logging/__init__.pyRs,  &N(RpRqRrRNRiRR(((s(/usr/lib64/python2.6/logging/__init__.pyRs cBs;eZdZddddZdZdZdZRS(sO A handler class which writes formatted logging records to disk files. taicCsytdjo d}ntii||_||_||_|oti |d|_ nt i ||i dS(sO Open the specified file and use it as the stream for logging. N( tcodecsRNRDREtabspatht baseFilenametmodeRR RiRRt_open(ReRGRRtdelay((s(/usr/lib64/python2.6/logging/__init__.pyRi2s      cCsV|ioH|it|ido|iinti|d|_ndS(s$ Closes the stream. RN(RRRcRRRN(Re((s(/usr/lib64/python2.6/logging/__init__.pyREs    cCsK|idjot|i|i}nti|i|i|i}|S(sx Open the current base file with the (original) mode and encoding. Return the resulting stream. N(RRNtopenRRR(ReR((s(/usr/lib64/python2.6/logging/__init__.pyRPscCs7|idjo|i|_nti||dS(s Emit a record. If the stream was not opened because 'delay' was specified in the constructor, open it before calling the superclass's emit. N(RRNRRR(ReR}((s(/usr/lib64/python2.6/logging/__init__.pyR[sN(RpRqRrRNRiRRR(((s(/usr/lib64/python2.6/logging/__init__.pyR.s  t PlaceHoldercBs eZdZdZdZRS(s PlaceHolder instances are used in the Manager logger hierarchy to take the place of nodes for which no loggers have been defined. This class is intended for internal use only and not as part of the public API. cCshd|6|_dS(sY Initialize with the specified logger being a child of this placeholder. N(RNt loggerMap(Retalogger((s(/usr/lib64/python2.6/logging/__init__.pyRipscCs%||ijod|i|tIntTypeRRJRR(ReR/R;R@R((s(/usr/lib64/python2.6/logging/__init__.pyRXs  cCst}|dj o |i}nd}xft|doU|i}tii|i}|t jo|i}q,n||i |i f}Pq,W|S(s Find the stack frame of the caller so that we can note the source file name, line number and function name. s(unknown file)is(unknown function)tf_codeN(s(unknown file)is(unknown function)( R*RNR)RcRRDREtnormcaset co_filenamet_srcfiletf_linenotco_name(ReRRwtcoRG((s(/usr/lib64/python2.6/logging/__init__.pyt findCalleris      c Cst||||||||} | dj oWxT| D]H} | djp| | ijotd| n| | | i| t TupleTypeR&RMRR:R( ReR/R;R@RMRRRRfR}((s(/usr/lib64/python2.6/logging/__init__.pyRs*cCs0|i o!|i|o|i|ndS(s Call the handlers for the specified record. This method is used for unpickled records received from a socket, as well as those created locally. Logger-level filtering is applied. N(RRt callHandlers(ReR}((s(/usr/lib64/python2.6/logging/__init__.pyRscCs(||ijo|ii|ndS(s; Add the specified handler to this logger. N(RR(Rethdlr((s(/usr/lib64/python2.6/logging/__init__.pyt addHandlerscCsD||ijo0|iz|ii|Wd|iXndS(s@ Remove the specified handler from this logger. N(RR4RR5(ReR((s(/usr/lib64/python2.6/logging/__init__.pyt removeHandlers  cCs|}d}xk|ocx?|iD]4}|d}|i|ijo|i|q q W|ip d}q|i}qW|djo<to5|ii o't i i d|i d|i_ ndS(s Pass a record to all relevant handlers. Loop through all handlers for this logger and its parents in the logger hierarchy. If no handler was found, output a one-off error message to sys.stderr. Stop searching up the hierarchy whenever a logger with the "propagate" attribute set to zero is found - that will be the last logger whose handlers are called. iis+No handlers could be found for logger "%s" N(RRBR/RRRNRRRRR&RRR:(ReR}RtfoundR((s(/usr/lib64/python2.6/logging/__init__.pyRs     "  cCs4|}x'|o|io|iS|i}q WtS(s Get the effective level for this logger. Loop through this logger and its parents in the logger hierarchy, looking for a non-zero logging level. Return the first one found. (R/RR(Retlogger((s(/usr/lib64/python2.6/logging/__init__.pytgetEffectiveLevels cCs(|ii|jodS||ijS(s; Is this logger enabled for level 'level'? i(RRR(ReR/((s(/usr/lib64/python2.6/logging/__init__.pyRsN(RpRqRrRRiRRRR"R!RRRRRRRNRRRRRRRR(((s(/usr/lib64/python2.6/logging/__init__.pyR s*          t RootLoggercBseZdZdZRS(s A root logger is not that different to any other logger, except that it must have a logging level and there is only one instance of it in the hierarchy. cCsti|d|dS(s= Initialize the logger with the name "root". RN(R Ri(ReR/((s(/usr/lib64/python2.6/logging/__init__.pyRis(RpRqRrRi(((s(/usr/lib64/python2.6/logging/__init__.pyRscBs_eZdZdZdZdZdZdZdZdZ dZ d Z RS( so An adapter for loggers which makes it easier to specify contextual information in logging output. cCs||_||_dS(sx Initialize the adapter with a logger and a dict-like object which provides contextual information. This constructor signature allows easy stacking of LoggerAdapters, if so desired. You can effectively pass keyword arguments as shown in the following example: adapter = LoggerAdapter(someLogger, dict(p1=v1, p2="v2")) N(RR(ReRR((s(/usr/lib64/python2.6/logging/__init__.pyRis cCs|i|d<||fS(s Process the logging message and keyword arguments passed in to a logging call to insert contextual information. You can either manipulate the message itself, the keyword args or both. Return the message and kwargs modified (or not) to suit your needs. Normally, you'll only need to override this one method in a LoggerAdapter subclass for your specific needs. R(R(ReR;R((s(/usr/lib64/python2.6/logging/__init__.pyRds cOs2|i||\}}|ii|||dS(s Delegate a debug call to the underlying logger, after adding contextual information from this adapter instance. N(RdRR(ReR;R@R((s(/usr/lib64/python2.6/logging/__init__.pyRscOs2|i||\}}|ii|||dS(s Delegate an info call to the underlying logger, after adding contextual information from this adapter instance. N(RdRR(ReR;R@R((s(/usr/lib64/python2.6/logging/__init__.pyR#scOs2|i||\}}|ii|||dS(s Delegate a warning call to the underlying logger, after adding contextual information from this adapter instance. N(RdRR"(ReR;R@R((s(/usr/lib64/python2.6/logging/__init__.pyR"+scOs2|i||\}}|ii|||dS(s Delegate an error call to the underlying logger, after adding contextual information from this adapter instance. N(RdRR(ReR;R@R((s(/usr/lib64/python2.6/logging/__init__.pyR3scOs<|i||\}}d|d<|ii|||dS(s Delegate an exception call to the underlying logger, after adding contextual information from this adapter instance. iRMN(RdRR(ReR;R@R((s(/usr/lib64/python2.6/logging/__init__.pyR;s cOs2|i||\}}|ii|||dS(s Delegate a critical call to the underlying logger, after adding contextual information from this adapter instance. N(RdRR(ReR;R@R((s(/usr/lib64/python2.6/logging/__init__.pyRDscOs5|i||\}}|ii||||dS(s Delegate a log call to the underlying logger, after adding contextual information from this adapter instance. N(RdRR(ReR/R;R@R((s(/usr/lib64/python2.6/logging/__init__.pyRLs( RpRqRrRiRdRRR"RRRR(((s(/usr/lib64/python2.6/logging/__init__.pyR s      s"%(levelname)s:%(name)s:%(message)sc Ksttidjo|id}|o%|idd}t||}n|id}t|}|idt}|idd }t||}|i |ti ||id}|d j oti |qnd S( s Do basic configuration for the logging system. This function does nothing if the root logger already has handlers configured. It is a convenience method intended for use by simple scripts to do one-shot configuration of the logging package. The default behaviour is to create a StreamHandler which writes to sys.stderr, set a formatter using the BASIC_FORMAT format string, and add the handler to the root logger. A number of optional keyword arguments may be specified, which can alter the default behaviour. filename Specifies that a FileHandler be created, using the specified filename, rather than a StreamHandler. filemode Specifies the mode to open the file, if filename is specified (if filemode is unspecified, it defaults to 'a'). format Use the specified format string for the handler. datefmt Use the specified date/time format. level Set the root logger level to the specified level. stream Use the specified stream to initialize the StreamHandler. Note that this argument is incompatible with 'filename' - if both are present, 'stream' is ignored. Note that you could specify a stream created using open(filename, mode) rather than passing the filename and mode in. However, it should be remembered that StreamHandler does not close its stream (since it may be using sys.stdout or sys.stderr), whereas FileHandler closes its stream when the handler is closed. iRGtfilemodeRRRRyR/N( R<RRR.RRRRNRRRR( RRGRRRRtdfsRzR/((s(/usr/lib64/python2.6/logging/__init__.pyR^s     cCs |otii|StSdS(s Return a logger with the specified name, creating it if necessary. If no name is specified, return the root logger. N(R RRR(R:((s(/usr/lib64/python2.6/logging/__init__.pyRscOs<ttidjo tnti|f||dS(sD Log a message with severity 'CRITICAL' on the root logger. iN(R<RRRR(R;R@R((s(/usr/lib64/python2.6/logging/__init__.pyRs cOs<ttidjo tnti|f||dS(sA Log a message with severity 'ERROR' on the root logger. iN(R<RRRR(R;R@R((s(/usr/lib64/python2.6/logging/__init__.pyRs cGst|f|hdd6dS(sa Log a message with severity 'ERROR' on the root logger, with exception information. iRMN(R(R;R@((s(/usr/lib64/python2.6/logging/__init__.pyRscOs<ttidjo tnti|f||dS(sC Log a message with severity 'WARNING' on the root logger. iN(R<RRRR"(R;R@R((s(/usr/lib64/python2.6/logging/__init__.pyR"s cOs<ttidjo tnti|f||dS(s@ Log a message with severity 'INFO' on the root logger. iN(R<RRRR(R;R@R((s(/usr/lib64/python2.6/logging/__init__.pyRs cOs<ttidjo tnti|f||dS(sA Log a message with severity 'DEBUG' on the root logger. iN(R<RRRR(R;R@R((s(/usr/lib64/python2.6/logging/__init__.pyRs cOs?ttidjo tnti||f||dS(sP Log 'msg % args' with the integer severity 'level' on the root logger. iN(R<RRRR(R/R;R@R((s(/usr/lib64/python2.6/logging/__init__.pyRs cCs|ti_dS(s= Disable all logging calls less severe than 'level'. N(RRR(R/((s(/usr/lib64/python2.6/logging/__init__.pyRscCsFx?|D]6}y|i|iWqtoq>qXqWdS(s Perform any cleanup actions in the logging system (e.g. flushing buffers). Should be called at application exit. N(RRR(t handlerListth((s(/usr/lib64/python2.6/logging/__init__.pytshutdowns cCsz tWd||XdS(N(R(tstatustold_exit((s(/usr/lib64/python2.6/logging/__init__.pytexithooks (s.pycs.pyo(((((((((VRrt__all__R&RDR>R9RRRRt ImportErrorRNRXRZt __author__t __status__t __version__t__date__Rctsept__file__RtlowerRERR*RURRWR]RbRRRRRR RRR-RRRR3R0R1R RRRRRRRRR RRRRR RRR RR RRRRRRRRRR"R!RRRRRtatexittregistertexitR(((s(/usr/lib64/python2.6/logging/__init__.pyts  T           g  *%,C< X Z   6