File: installation.rst

package info (click to toggle)
python-tiered-debug 1.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 252 kB
  • sloc: python: 808; makefile: 13
file content (70 lines) | stat: -rw-r--r-- 1,438 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
.. _installation:

Installation
============

Requirements
------------

- Python 3.8 or higher

Install tiered-debug
--------------------

``tiered-debug`` is typically installed as a dependecy. 

1. **pyproject.toml**:

   Add ``tiered-debug`` to your ``pyproject.toml``:

   .. code-block:: toml

      dependencies = [
         'tiered-debug==1.2.0'
      ]

2. **setup.py**:

   If you are using ``setup.py``, add ``tiered-debug`` to your ``install_requires``:

   .. code-block:: python

      from setuptools import setup, find_packages

      setup(
          name='your_project',
          version='0.1.0',
          packages=find_packages(),
          install_requires=[
              'tiered-debug==1.2.0'
          ],
      )

3. **requirements.txt**:
   
   This is no longer common, but you can add ``tiered-debug`` to your ``requirements.txt``:


4. **Verify installation**:

   Test the module by running a simple script:

   .. code-block:: python

      from tiered_debug import TieredDebug
      debug = TieredDebug(level=2)
      debug.lv1("Test message")

Configuration
-------------

You can optionally configure the logger by adding a handler:

.. code-block:: python

   import logging
   debug = TieredDebug()
   debug.add_handler(logging.StreamHandler(), formatter=logging.Formatter(
       "%(asctime)s %(funcName)s:%(lineno)d %(message)s"))

For Elasticsearch logging, add a custom handler (see :ref:`usage`).