~ubuntu-branches/ubuntu/precise/python3.2/precise-proposed

« back to all changes in this revision

Viewing changes to Doc/library/logging.rst

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2012-03-09 18:40:39 UTC
  • mfrom: (30.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20120309184039-j3yk2emxr1plyo21
Tags: 3.2.3~rc1-1
* Python 3.2.3 release candidate 1.
* Update to 20120309 from the 3.2 branch.
* Fix libpython.a symlink. Closes: #660146.
* Build-depend on xauth.
* Run the gdb tests for the debug build only.

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
 
58
58
.. attribute:: Logger.propagate
59
59
 
60
 
   If this evaluates to false, logging messages are not passed by this logger or by
61
 
   its child loggers to the handlers of higher level (ancestor) loggers. The
62
 
   constructor sets this attribute to 1.
 
60
   If this evaluates to true, logging messages are passed by this logger and by
 
61
   its child loggers to the handlers of higher level (ancestor) loggers.
 
62
   Messages are passed directly to the ancestor loggers' handlers - neither the
 
63
   level nor filters of the ancestor loggers in question are considered.
 
64
 
 
65
   If this evaluates to false, logging messages are not passed to the handlers
 
66
   of ancestor loggers.
 
67
 
 
68
   The constructor sets this attribute to ``True``.
63
69
 
64
70
 
65
71
.. method:: Logger.setLevel(lvl)
81
87
   If the root is reached, and it has a level of NOTSET, then all messages will be
82
88
   processed. Otherwise, the root's level will be used as the effective level.
83
89
 
 
90
   .. versionchanged:: 3.2
 
91
      The *lvl* parameter now accepts a string representation of the
 
92
      level such as 'INFO' as an alternative to the integer constants
 
93
      such as :const:`INFO`.
 
94
 
84
95
 
85
96
.. method:: Logger.isEnabledFor(lvl)
86
97
 
137
148
 
138
149
       Stack (most recent call last):
139
150
 
140
 
   This mimics the `Traceback (most recent call last):` which is used when
 
151
   This mimics the ``Traceback (most recent call last):`` which is used when
141
152
   displaying exception frames.
142
153
 
143
154
   The third keyword argument is *extra* which can be used to pass a
313
324
   severe than *lvl* will be ignored. When a handler is created, the level is set
314
325
   to :const:`NOTSET` (which causes all messages to be processed).
315
326
 
 
327
   .. versionchanged:: 3.2
 
328
      The *lvl* parameter now accepts a string representation of the
 
329
      level such as 'INFO' as an alternative to the integer constants
 
330
      such as :const:`INFO`.
 
331
 
316
332
 
317
333
.. method:: Handler.setFormatter(form)
318
334
 
359
375
.. method:: Handler.handleError(record)
360
376
 
361
377
   This method should be called from handlers when an exception is encountered
362
 
   during an :meth:`emit` call. By default it does nothing, which means that
363
 
   exceptions get silently ignored. This is what is mostly wanted for a logging
364
 
   system - most users will not care about errors in the logging system, they are
365
 
   more interested in application errors. You could, however, replace this with a
366
 
   custom handler if you wish. The specified record is the one which was being
367
 
   processed when the exception occurred.
 
378
   during an :meth:`emit` call. If the module-level attribute
 
379
   ``raiseExceptions`` is ``False``, exceptions get silently ignored. This is
 
380
   what is mostly wanted for a logging system - most users will not care about
 
381
   errors in the logging system, they are more interested in application
 
382
   errors. You could, however, replace this with a custom handler if you wish.
 
383
   The specified record is the one which was being processed when the exception
 
384
   occurred. (The default value of ``raiseExceptions`` is ``True``, as that is
 
385
   more useful during development).
368
386
 
369
387
 
370
388
.. method:: Handler.format(record)
820
838
 
821
839
       Stack (most recent call last):
822
840
 
823
 
   This mimics the `Traceback (most recent call last):` which is used when
 
841
   This mimics the ``Traceback (most recent call last):`` which is used when
824
842
   displaying exception frames.
825
843
 
826
844
   The third optional keyword argument is *extra* which can be used to pass a
1059
1077
   If *capture* is ``True``, warnings issued by the :mod:`warnings` module will
1060
1078
   be redirected to the logging system. Specifically, a warning will be
1061
1079
   formatted using :func:`warnings.formatwarning` and the resulting string
1062
 
   logged to a logger named 'py.warnings' with a severity of `WARNING`.
 
1080
   logged to a logger named ``'py.warnings'`` with a severity of ``'WARNING'``.
1063
1081
 
1064
1082
   If *capture* is ``False``, the redirection of warnings to the logging system
1065
1083
   will stop, and warnings will be redirected to their original destinations
1066
 
   (i.e. those in effect before `captureWarnings(True)` was called).
 
1084
   (i.e. those in effect before ``captureWarnings(True)`` was called).
1067
1085
 
1068
1086
 
1069
1087
.. seealso::