11\section {\module {logging} ---
22 Logging facility for Python }
33
4- \declaremodule {standard}{logging} % standard library, in Python
4+ \declaremodule {standard}{logging}
55
66% These apply to all modules, and may be given more than once:
77
@@ -478,7 +478,7 @@ \subsubsection{FileHandler}
478478\begin {classdesc }{FileHandler}{filename\optional {, mode}}
479479Returns a new instance of the \class {FileHandler} class. The specified
480480file is opened and used as the stream for logging. If \var {mode} is
481- not specified, \constant {"a" } is used. By default, the file grows
481+ not specified, \constant {'a' } is used. By default, the file grows
482482indefinitely.
483483\end {classdesc }
484484
@@ -494,8 +494,8 @@ \subsubsection{RotatingFileHandler}
494494
495495The \class {RotatingFileHandler} class supports rotation of disk log files.
496496
497- \begin {classdesc }{RotatingFileHandler}{filename\optional {, mode, maxBytes ,
498- backupCount}}
497+ \begin {classdesc }{RotatingFileHandler}{filename\optional {, mode\optional { ,
498+ maxBytes \optional {, backupCount}} }}
499499Returns a new instance of the \class {RotatingFileHandler} class. The
500500specified file is opened and used as the stream for logging. If
501501\var {mode} is not specified, \code {'a'} is used. By default, the
@@ -635,21 +635,21 @@ \subsubsection{NTEventLogHandler}
635635you can use it, you need Mark Hammond's Win32 extensions for Python
636636installed.
637637
638- \begin {classdesc }{NTEventLogHandler}{appname
639- \optional {, dllname\optional {, logtype}}}
638+ \begin {classdesc }{NTEventLogHandler}{appname\optional {,
639+ dllname\optional {, logtype}}}
640640Returns a new instance of the \class {NTEventLogHandler} class. The
641641\var {appname} is used to define the application name as it appears in the
642642event log. An appropriate registry entry is created using this name.
643643The \var {dllname} should give the fully qualified pathname of a .dll or .exe
644644which contains message definitions to hold in the log (if not specified,
645- \constant {" win32service.pyd" } is used - this is installed with the Win32
645+ \code {' win32service.pyd' } is used - this is installed with the Win32
646646extensions and contains some basic placeholder message definitions.
647647Note that use of these placeholders will make your event logs big, as the
648648entire message source is held in the log. If you want slimmer logs, you have
649649to pass in the name of your own .dll or .exe which contains the message
650650definitions you want to use in the event log). The \var {logtype} is one of
651- \constant {" Application" }, \constant {" System" } or \constant {" Security" }, and
652- defaults to \constant {" Application" }.
651+ \code {' Application' }, \code {' System' } or \code {' Security' }, and
652+ defaults to \code {' Application' }.
653653\end {classdesc }
654654
655655\begin {methoddesc }{close}{}
@@ -687,7 +687,7 @@ \subsubsection{NTEventLogHandler}
687687logger being an ID rather than a format string. Then, in here,
688688you could use a dictionary lookup to get the message ID. This
689689version returns 1, which is the base message ID in
690- \constant {win32service.pyd}.
690+ \file {win32service.pyd}.
691691\end {methoddesc }
692692
693693\subsubsection {SMTPHandler }
@@ -797,7 +797,7 @@ \subsection{Formatter Objects}
797797which can be interpreted by either a human or an external system. The
798798base
799799\class {Formatter} allows a formatting string to be specified. If none is
800- supplied, the default value of "\%s (message)\\n" is used.
800+ supplied, the default value of \code {' \% (message)s \e '} is used.
801801
802802A Formatter can be initialized with a format string which makes use of
803803knowledge of the \class {LogRecord} attributes - such as the default value
@@ -809,35 +809,40 @@ \subsection{Formatter Objects}
809809
810810Currently, the useful mapping keys in a LogRecord are:
811811
812- \begin {tableii }{l|l}{formats}{Format}{Description}
813- \lineii {\% (name)s}{Name of the logger (logging channel).}
814- \lineii {\% (levelno)s}{Numeric logging level for the message (DEBUG, INFO,
815- WARNING, ERROR, CRITICAL).}
816- \lineii {\% (levelname)s}{Text logging level for the message ("DEBUG", "INFO" ,
817- "WARNING" , "ERROR" , "CRITICAL" ).}
818- \lineii {\% (pathname)s}{Full pathname of the source file where the logging
819- call was issued (if available).}
820- \lineii {\% (filename)s}{Filename portion of pathname.}
821- \lineii {\% (module)s}{Module (name portion of filename).}
822- \lineii {\% (lineno)d}{Source line number where the logging call was issued
823- (if available).}
824- \lineii {\% (created)f}{Time when the LogRecord was created (as returned by
825- \code {time.time()}).}
826- \lineii {\% (asctime)s}{Human-readable time when the LogRecord was created.
827- By default this is of the form `` 2003-07-08 16:49:45,896'' (the numbers
828- after the comma are millisecond portion of the time).}
829- \lineii {\% (msecs)d}{Millisecond portion of the time when the LogRecord
830- was created.}
831- \lineii {\% (thread)d}{Thread ID (if available).}
832- \lineii {\% (process)d}{Process ID (if available).}
833- \lineii {\% (message)s}{The logged message, computed as msg \% args.}
812+ \begin {tableii }{l|l}{code}{Format}{Description}
813+ \lineii {\% (name)s} {Name of the logger (logging channel).}
814+ \lineii {\% (levelno)s} {Numeric logging level for the message
815+ (\constant {DEBUG}, \constant {INFO},
816+ \constant {WARNING}, \constant {ERROR},
817+ \constant {CRITICAL}).}
818+ \lineii {\% (levelname)s}{Text logging level for the message
819+ (\code {'DEBUG'}, \code {'INFO'},
820+ \code {'WARNING'}, \code {'ERROR'},
821+ \code {'CRITICAL'}).}
822+ \lineii {\% (pathname)s} {Full pathname of the source file where the logging
823+ call was issued (if available).}
824+ \lineii {\% (filename)s} {Filename portion of pathname.}
825+ \lineii {\% (module)s} {Module (name portion of filename).}
826+ \lineii {\% (lineno)d} {Source line number where the logging call was issued
827+ (if available).}
828+ \lineii {\% (created)f} {Time when the LogRecord was created (as
829+ returned by \function {time.time()}).}
830+ \lineii {\% (asctime)s} {Human-readable time when the LogRecord was created.
831+ By default this is of the form
832+ `` 2003-07-08 16:49:45,896'' (the numbers after the
833+ comma are millisecond portion of the time).}
834+ \lineii {\% (msecs)d} {Millisecond portion of the time when the
835+ \class {LogRecord} was created.}
836+ \lineii {\% (thread)d} {Thread ID (if available).}
837+ \lineii {\% (process)d} {Process ID (if available).}
838+ \lineii {\% (message)s} {The logged message, computed as \code {msg \% args}.}
834839\end {tableii }
835840
836841\begin {classdesc }{Formatter}{\optional {fmt\optional {, datefmt}}}
837842Returns a new instance of the \class {Formatter} class. The
838843instance is initialized with a format string for the message as a whole,
839844as well as a format string for the date/time portion of a message. If
840- no \var {fmt} is specified, "\ %(message)s" is used. If no \var {datefmt}
845+ no \var {fmt} is specified, \code { \ % (message)s'} is used. If no \var {datefmt}
841846is specified, the ISO8601 date format is used.
842847\end {classdesc }
843848
@@ -847,7 +852,7 @@ \subsection{Formatter Objects}
847852Before formatting the dictionary, a couple of preparatory steps
848853are carried out. The \var {message} attribute of the record is computed
849854using \var {msg} \% \var {args}. If the formatting string contains
850- \constant {" (asctime)" }, \method {formatTime()} is called to format the
855+ \code {' (asctime)' }, \method {formatTime()} is called to format the
851856event time. If there is exception information, it is formatted using
852857\method {formatException()} and appended to the message.
853858\end {methoddesc }
@@ -905,7 +910,7 @@ \subsection{LogRecord Objects}
905910facilitate extension.
906911
907912\begin {classdesc }{LogRecord}{name, lvl, pathname, lineno, msg, args,
908- exc_info}
913+ exc_info}
909914Returns an instance of \class {LogRecord} initialized with interesting
910915information. The \var {name} is the logger name; \var {lvl} is the
911916numeric level; \var {pathname} is the absolute pathname of the source
@@ -931,10 +936,11 @@ \subsection{Configuration}
931936
932937\subsubsection {Configuration functions }
933938
934- The following functions allow the logging module to be configured. Before
935- they can be used, you must import \module {logging.config}. Their use is optional -
936- you can configure the logging module entirely by making calls to the main
937- API (defined in \module {logging} itself) and defining handlers which are declared
939+ The following functions allow the logging module to be
940+ configured. Before they can be used, you must import
941+ \module {logging.config}. Their use is optional --- you can configure
942+ the logging module entirely by making calls to the main API (defined
943+ in \module {logging} itself) and defining handlers which are declared
938944either in \module {logging} or \module {logging.handlers}.
939945
940946\begin {funcdesc }{fileConfig}{fname\optional {, defaults}}
0 commit comments