File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -470,6 +470,27 @@ \subsection{Basic example \label{minimal-example}}
470470that if both \var {stream} and \var {filename} keyword arguments are passed,
471471the \var {stream} argument is ignored.
472472
473+ Of course, you can put variable information in your output. To do this,
474+ simply have the message be a format string and pass in additional arguments
475+ containing the variable information, as in the following example:
476+
477+ \begin {verbatim }
478+ import logging
479+
480+ logging.basicConfig(level=logging.DEBUG,
481+ format='%(asctime)s %(levelname)-8s %(message)s',
482+ datefmt='%a, %d %b %Y %H:%M:%S',
483+ filename='/temp/myapp.log',
484+ filemode='w')
485+ logging.error('Pack my box with %d dozen %s', 12, 'liquor jugs')
486+ \end {verbatim }
487+
488+ which would result in
489+
490+ \begin {verbatim }
491+ Wed, 21 Jul 2004 15:35:16 ERROR Pack my box with 12 dozen liquor jugs
492+ \end {verbatim }
493+
473494\subsection {Handler Objects }
474495
475496Handlers have the following attributes and methods. Note that
You can’t perform that action at this time.
0 commit comments