|
1 | | -🪵 Logtail Integration For Python |
| 1 | +# Logtail - Python Logging Made Easy |
| 2 | + |
| 3 | + [](https://betterstack.com/logtail) |
| 4 | + |
2 | 5 |
|
3 | 6 | [](LICENSE.md) |
| 7 | +[](https://badge.fury.io/py/logtail-python) |
4 | 8 |  |
5 | 9 |
|
6 | | -This repository contains the [Logtail](https://logtail.com) Python library, turning your application logs into rich structured events. |
| 10 | +Collect logs directly from any Python code, including Django. |
7 | 11 |
|
8 | | ---- |
| 12 | +[Logtail](https://logtail.com) is a hosted service that centralizes all of your logs into one place. Allowing for analysis, correlation and filtering with SQL. Actionable Grafana dashboards and collaboration come built-in. Logtail works with [any language or platform and any data source](https://docs.logtail.com/). |
9 | 13 |
|
10 | 14 | ### Features |
| 15 | +- Simple integration. Integrates with the Python `logging` library. |
| 16 | +- Support for structured logging and events. |
| 17 | +- Automatically captures useful context. |
| 18 | +- Performant, light weight, with a thoughtful design. |
| 19 | + |
| 20 | +### Supported language versions |
| 21 | +- Python 3.6.5 or newer |
| 22 | +- `pip` 20.0.2 or newer |
11 | 23 |
|
12 | | -* Simple integration. Integrates with the Python `logging` library. |
13 | | -* Support for structured logging and events. |
14 | | -* Automatically captures useful context. |
15 | | -* Performant, light weight, with a thoughtful design. |
| 24 | +# Installation |
| 25 | +Install the Logtail Python client library using the `pip` command: |
| 26 | + |
| 27 | +```bash |
| 28 | +pip install logtail-python |
| 29 | +``` |
| 30 | + |
| 31 | +*Make sure you install the `logtail-python` package and not a different package with the `logtail` keyword in the package name from a different author.* |
16 | 32 |
|
17 | 33 | --- |
18 | 34 |
|
19 | | -### Installation |
| 35 | +# Example project |
20 | 36 |
|
21 | | -Install the Logtail client library from PyPI as you would with any other package: |
| 37 | +To help you get started with using Logtail in your Python projects, we have prepared a simple Python program that showcases the usage of Logtail logger. |
22 | 38 |
|
23 | | -``` |
| 39 | +## Download the example project |
| 40 | + |
| 41 | +You can download the example project from GitHub directly or you can clone it to a select directory. Then install the `logtail-python` client library as shown before: |
| 42 | + |
| 43 | +```bash |
24 | 44 | pip install logtail-python |
25 | 45 | ``` |
26 | 46 |
|
27 | | -Make sure you install the `logtail-python` package and not a different package with the `logtail` keyword in the package name from a different author. |
| 47 | + ## Run the example project |
| 48 | + |
| 49 | + To run the example application, simply run the following command: |
| 50 | + |
| 51 | +```bash |
| 52 | +python main.py <source-token> |
| 53 | +``` |
| 54 | + |
| 55 | +*Don't forget to replace `<source-token>` with your actual source token which you can find by going to logtail.com -> sources -> edit.* |
| 56 | + |
| 57 | + |
| 58 | +If you have trouble running the command above, check your Python installation and try running it with the `python3` command instead. It should give you the following output: |
| 59 | + |
| 60 | +``` |
| 61 | +Output: |
| 62 | +All done! You can check your logs now. |
| 63 | +``` |
| 64 | + |
| 65 | +This example project will create a total of 6 logs. Each corresponding to its respective method. |
| 66 | + |
| 67 | +## Explore how example project works |
| 68 | + |
| 69 | +Learn how to setup Python logging by exploring the working of the example project in detail. |
| 70 | + |
| 71 | +--- |
| 72 | + |
| 73 | +## Get in touch |
| 74 | + |
| 75 | +Have any questions? Please explore the Logtail [documentation](https://docs.logtail.com/) or contact our [support](https://betterstack.com/help). |
0 commit comments