diff options
Diffstat (limited to 'Doc/howto/logging.rst')
-rw-r--r-- | Doc/howto/logging.rst | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/Doc/howto/logging.rst b/Doc/howto/logging.rst index 51e8430..82d1308 100644 --- a/Doc/howto/logging.rst +++ b/Doc/howto/logging.rst @@ -106,7 +106,9 @@ A very simple example is:: logging.warning('Watch out!') # will print a message to the console logging.info('I told you so') # will not print anything -If you type these lines into a script and run it, you'll see:: +If you type these lines into a script and run it, you'll see: + +.. code-block:: none WARNING:root:Watch out! @@ -230,7 +232,9 @@ append the variable data as arguments. For example:: import logging logging.warning('%s before you %s', 'Look', 'leap!') -will display:: +will display: + +.. code-block:: none WARNING:root:Look before you leap! @@ -594,7 +598,9 @@ logger, a console handler, and a simple formatter using Python code:: logger.error('error message') logger.critical('critical message') -Running this module from the command line produces the following output:: +Running this module from the command line produces the following output: + +.. code-block:: shell-session $ python simple_logging_module.py 2005-03-19 15:10:26,618 - simple_example - DEBUG - debug message @@ -653,7 +659,9 @@ Here is the logging.conf file:: format=%(asctime)s - %(name)s - %(levelname)s - %(message)s datefmt= -The output is nearly identical to that of the non-config-file-based example:: +The output is nearly identical to that of the non-config-file-based example: + +.. code-block:: shell-session $ python simple_logging_config.py 2005-03-19 15:38:55,977 - simpleExample - DEBUG - debug message @@ -1073,4 +1081,3 @@ take up any memory. Useful handlers included with the logging module. :ref:`A logging cookbook <logging-cookbook>` - |