зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1047429 - Remove unstructured mozlog docs to reduce risk of use in new code. r=ahal
--HG-- extra : rebase_source : 8ad569f3898f4d3758f99d50528a8c4c5ac13320
This commit is contained in:
Родитель
f6fd7810ec
Коммит
650a0fbdc5
|
@ -8,5 +8,4 @@ less verbose. We created some libraries to make doing this easy.
|
|||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
mozlog
|
||||
mozlog_structured
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
:mod:`mozlog` --- Easy, configurable and uniform logging
|
||||
========================================================
|
||||
|
||||
Mozlog is a python package intended to simplify and standardize logs
|
||||
in the Mozilla universe. It wraps around python's logging module and
|
||||
adds some additional functionality.
|
||||
|
||||
.. note::
|
||||
For the purposes of logging results and other output from test runs,
|
||||
:doc:`mozlog.structured<mozlog_structured>` should now be used
|
||||
instead of this module.
|
||||
|
||||
.. automodule:: mozlog
|
||||
:members: getLogger
|
||||
|
||||
.. autoclass:: MozLogger
|
||||
:members: testStart, testEnd, testPass, testFail, testKnownFail
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
Log to stdout::
|
||||
|
||||
import mozlog
|
||||
log = mozlog.getLogger('MODULE_NAME')
|
||||
log.setLevel(mozlog.INFO)
|
||||
log.info('This message will be printed to stdout')
|
||||
log.debug('This won't')
|
||||
log.testPass('A test has passed')
|
||||
mozlog.shutdown()
|
||||
|
||||
Log to a file::
|
||||
|
||||
import mozlog
|
||||
log = mozlog.getLogger('MODULE_NAME', handler=mozlog.FileHandler('path/to/log/file'))
|
||||
log.warning('Careful!')
|
||||
log.testKnownFail('We know the cause for this failure')
|
||||
mozlog.shutdown()
|
||||
|
||||
Log from an existing object using the LoggingMixin::
|
||||
|
||||
import mozlog
|
||||
class Loggable(mozlog.LoggingMixin):
|
||||
"""Trivial class inheriting from LoggingMixin"""
|
||||
def say_hello(self):
|
||||
self.info("hello")
|
||||
|
||||
loggable = Loggable()
|
||||
loggable.say_hello()
|
||||
|
||||
|
||||
.. _logging: http://docs.python.org/library/logging.html
|
Загрузка…
Ссылка в новой задаче