@@ -52,7 +52,7 @@ \section{\module{logging} ---
5252\class {Handler} class. Handlers are responsible for ensuring that a logged
5353message (in the form of a \class {LogRecord}) ends up in a particular
5454location (or set of locations) which is useful for the target audience for
55- that message (e.g. end users, support desk staff, system administrators,
55+ that message (such as end users, support desk staff, system administrators,
5656developers). Handlers are passed \class {LogRecord} instances intended for
5757particular destinations. Each logger can have zero, one or more handlers
5858associated with it (via the \method {addHandler} method of \class {Logger}).
@@ -204,6 +204,13 @@ \section{\module{logging} ---
204204returned.
205205\end {funcdesc }
206206
207+ \begin {funcdesc }{makeLogRecord}{attrdict}
208+ Creates and returns a new \class {LogRecord} instance whose attributes are
209+ defined by \var {attrdict}. This function is useful for taking a pickled
210+ \class {LogRecord} attribute dictionary, sent over a socket, and reconstituting
211+ it as a \class {LogRecord} instance at the receiving end.
212+ \end {funcdesc }
213+
207214\begin {funcdesc }{basicConfig}{}
208215Does basic configuration for the logging system by creating a
209216\class {StreamHandler} with a default \class {Formatter} and adding it to
@@ -266,7 +273,7 @@ \subsection{Logger Objects}
266273Indicates the effective level for this logger. If a value other than
267274\constant {NOTSET} has been set using \method {setLevel()}, it is returned.
268275Otherwise, the hierarchy is traversed towards the root until a value
269- other than \constant {NOTSET} is found,and that value is returned.
276+ other than \constant {NOTSET} is found, and that value is returned.
270277\end {methoddesc }
271278
272279\begin {methoddesc }{debug}{msg\optional {, *args\optional {, **kwargs}}}
@@ -535,9 +542,11 @@ \subsubsection{SocketHandler}
535542\end {methoddesc }
536543
537544\begin {methoddesc }{emit}{}
538- Pickles the record and writes it to the socket in binary format.
539- If there is an error with the socket, silently drops the packet.
540- If the connection was previously lost, re-establishes the connection.
545+ Pickles the record's attribute dictionary and writes it to the socket in
546+ binary format. If there is an error with the socket, silently drops the
547+ packet. If the connection was previously lost, re-establishes the connection.
548+ To unpickle the record at the receiving end into a LogRecord, use the
549+ \function {makeLogRecord} function.
541550\end {methoddesc }
542551
543552\begin {methoddesc }{handleError}{}
@@ -553,8 +562,8 @@ \subsubsection{SocketHandler}
553562\end {methoddesc }
554563
555564\begin {methoddesc }{makePickle}{record}
556- Pickles the record in binary format with a length prefix, and returns
557- it ready for transmission across the socket.
565+ Pickles the record's attribute dictionary in binary format with a length
566+ prefix, and returns it ready for transmission across the socket.
558567\end {methoddesc }
559568
560569\begin {methoddesc }{send}{packet}
@@ -574,8 +583,11 @@ \subsubsection{DatagramHandler}
574583\end {classdesc }
575584
576585\begin {methoddesc }{emit}{}
577- Pickles the record and writes it to the socket in binary format.
578- If there is an error with the socket, silently drops the packet.
586+ Pickles the record's attribute dictionary and writes it to the socket in
587+ binary format. If there is an error with the socket, silently drops the
588+ packet.
589+ To unpickle the record at the receiving end into a LogRecord, use the
590+ \function {makeLogRecord} function.
579591\end {methoddesc }
580592
581593\begin {methoddesc }{makeSocket}{}
@@ -584,8 +596,7 @@ \subsubsection{DatagramHandler}
584596\end {methoddesc }
585597
586598\begin {methoddesc }{send}{s}
587- Send a pickled string to a socket. This function allows for
588- partial sends which can happen when the network is busy.
599+ Send a pickled string to a socket.
589600\end {methoddesc }
590601
591602\subsubsection {SysLogHandler }
@@ -789,8 +800,8 @@ \subsection{Formatter Objects}
789800supplied, the default value of "\%s(message)\\n" is used.
790801
791802A Formatter can be initialized with a format string which makes use of
792- knowledge of the \class {LogRecord} attributes - e.g. the default value
793- mentioned above makes use of the fact that the user's message and
803+ knowledge of the \class {LogRecord} attributes - such as the default value
804+ mentioned above making use of the fact that the user's message and
794805arguments are pre- formatted into a LogRecord's \var {message}
795806attribute. Currently, the useful attributes in a LogRecord are
796807described by:
@@ -916,7 +927,11 @@ \subsection{Configuration}
916927
917928\subsubsection {Configuration functions }
918929
919- The following functions allow the logging module to be configured.
930+ The following functions allow the logging module to be configured. Before
931+ they can be used, you must import \module {logging.config}. Their use is optional -
932+ you can configure the logging module entirely by making calls to the main
933+ API (defined in \module {logging} itself) and defining handlers which are declared
934+ either in \module {logging} or \module {logging.handlers}.
920935
921936\begin {funcdesc }{fileConfig}{fname\optional {, defaults}}
922937Reads the logging configuration from a ConfigParser-format file named
@@ -1013,7 +1028,7 @@ \subsubsection{Configuration file format}
10131028higher up the logger hierarchy from this logger, or 0 to indicate that
10141029messages are \strong {not} propagated to handlers up the hierarchy. The
10151030\code {qualname} entry is the hierarchical channel name of the logger,
1016- i.e. the name used by the application to get the logger.
1031+ for example, the name used by the application to get the logger.
10171032
10181033Sections which specify handler configuration are exemplified by the
10191034following.
0 commit comments