---------------------------------------

TransLogger will automatically setup a logging handler to the console when called with no arguments.
It "just works" in environments that don't configure logging.
This is by virtue of its default configuration setting of ``setup_console_handler = True``.


.. TODO:
.. .. _logging-to-a-file-using-python:

.. Logging to a File Using Python
.. ------------------------------

.. Show how to configure the WSGI logger via python.


.. _logging-to-a-file-using-pastedeploy:

Logging to a File Using PasteDeploy
------------------------------------

TransLogger does not write to files, and the Python logging system
must be configured to do this.  The Python class :class:`FileHandler`
logging handler can be used alongside TransLogger to create an
``access.log`` file similar to Apache's.

Like any standard :term:`middleware` with a Paste entry point,
TransLogger can be configured to wrap your application using ``.ini``
file syntax.  First add a
``[filter:translogger]`` section, then use a ``[pipeline:main]``
section file to form a WSGI pipeline with both the translogger and
your application in it.  For instance, if you have this:

.. code-block:: ini

   [app:wsgiapp]
   use = egg:mypackage#wsgiapp

   [server:main]
   use = egg:waitress#main
   host = 127.0.0.1
   port = 8080

Add this:

.. code-block:: ini

   [filter:translogger]
   use = egg:Paste#translogger
   setup_console_handler = False

   [pipeline:main]
   pipeline = translogger
              wsgiapp

Using PasteDeploy this way to form and serve a pipeline is equivalent to
wrapping your app in a TransLogger instance via the bottom of the ``main``
function of your project's ``__init__`` file:

.. code-block:: python

    from mypackage import wsgiapp
    from waitress import serve
    from paste.translogger import TransLogger
    serve(TransLogger(wsgiapp, setup_console_handler=False))

.. note::
    TransLogger will automatically set up a logging handler to the console when
    called with no arguments, so it "just works" 