Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/denver-code/logdriver
logunit python client
https://github.com/denver-code/logdriver
Last synced: 4 days ago
JSON representation
logunit python client
- Host: GitHub
- URL: https://github.com/denver-code/logdriver
- Owner: denver-code
- Created: 2023-08-14T16:00:05.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-14T18:58:00.000Z (over 1 year ago)
- Last Synced: 2023-08-14T19:30:50.653Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 14.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# LogDriver Python Library
The LogDriver Python Library is a tool that allows you to easily send and retrieve logs from a [log server](https://github.com/denver-code/logunit). It provides a user-friendly interface to interact with the log server's API endpoints. This library is particularly useful for applications where security is not a primary concern, as it lacks authentication and encryption mechanisms.
## Getting Started
To start using the LogDriver Python Library, you can install it directly from the GitHub repository. Follow these steps:
1. **Clone the Repository**: Clone the LogDriver Unsecured repository to your local machine using the following command:
```bash
git clone https://github.com/denver-code/logdriver.git
```2. **Move the logdriver** folder to your project's root or utils directory.
3. **Install dependencies**
```bash
poetry add requests
pip install requests
```
4. **Import the library**: Import the library into your project using the following command:```python
import logdriver
```## Unsecured LogDriver usage
1. **Initialize the UnsecureLogDriver**: Initialize the LogDriver using the following command:
```python
from logdriver.unsecured import UnsecuredDriverudriver = UnsecuredDriver("driver-client", "http://localhost:8000")
```2. **Send a log**: Send a log to the LogDriver using the following command:
```python
udriver.log({"message": "Hello world!", "data": {"foo": "bar"}})
```3. **Retrieve log by reference**: Retrieve logs from the LogDriver using the following command:
```python
reference_id = udriver.log({"message": "Hello world!", "data": {"foo": "bar"}})
udriver.get(reference_id)
```4. **Retrieve today's logs**: Retrieve logs from the LogDriver using the following command:
```python
udriver.today()
```5. **Log query filters**: Retrieve logs from the LogDriver using the following command:
```python
udriver.today(offset=0, limit=1, service='driver-client', level='INFO')
```