<commit_before># Trakerr - Python API client
Get your application events and errors to Trakerr via the *Trakerr API*.

You will need your API key to send events to trakerr.

## Requirements
Python 2.7.9+ and 3.4+

## 3-minute Integration Guide
If you're already using the python logger in some capacity, you can integrate with Trakerr quickly. First, issue a pip install to get the latest version:

To install from master, simply use:
```bash
pip install git+https://github.com/trakerr-com/trakerr-python.git
```
(you may need to run `pip` with root permission: `sudo -H pip install git+https://github.com/trakerr-com/trakerr-python.git`)

or upgrade an installation with a command from the [advanced pip commands](#Advanced-pip-install-commands-for-Trakerr) section.

Once installation is complete, add this import from wherever you instantiate your loggers.

```python
import logging #Your previous logging import here
from trakerr import TrakerrHandler #New import.
```

And then you'll need to create a handler and a logger object and attach them before you can use them later on.

```python
#Your original logger.
logger = logging.getLogger("Logger name")

#Instantiate Trakerr's logger handler. By default the handler will only log WARNING and above.
th = TrakerrHandler("<api-key>", "App Version number here", "Deployment stage here")

#Attach our handler to your logger.
logger.addHandler(th)<commit_msg>Update Readme Update Readme with instruction to add the handler to the root logger.<commit_after># Trakerr - Python API client
Get your application events and errors to Trakerr via the *Trakerr API*.

You will need your API key to send events to trakerr.

## Requirements
Python 2.7.9+ and 3.4+

## 3-minute Integration Guide
If you're already using the python logger in some capacity, you can integrate with Trakerr quickly. First, issue a pip install to get the latest version:

To install from master, simply use:
```bash
pip install git+https://github.com/trakerr-com/trakerr-python.git
```
(you may need to run `pip` with root permission: `sudo -H pip install git+https://github.com/trakerr-com/trakerr-python.git`)

or upgrade an installation with a command from the [advanced pip commands](#Advanced-pip-install-commands-for-Trakerr) section.

Once installation is complete, add this import from wherever you instantiate your loggers.

```python
import logging #Your previous logging import here
from trakerr import TrakerrHandler #New import.
```

And then you'll need to create a handler and a logger object and attach them before you can use them later on.

```python
#Your original logger.
logger = logging.getLogger("Logger name")

#Instantiate Trakerr's logger handler. By default the handler will only log WARNING and above.
th = TrakerrHandler("<api-key>", "App Version number here", "Deployment stage here")

#Attach our handler to the root logger.
logging.getLogger('').addHandler(th)

#Alternatively attach our handler to your logger for a single logger instance.
logger.addHandler(th)
{'fraction_non_alphanumeric': 0.08192371475953565, 'fraction_numerical': 0.003980099502487562, 'mean_word_length': 4.8111753371868975, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '35828', 'n_tokens_mistral': 867, 'n_tokens_neox': 817, 'n_words': 396}