Python integration package for LogHarvestor
Project description
log-harvestor-py
Documentation
See API Docs for Log-Harvestor API Documetnation.
This package is specific to Python.
Please see our docs for other supported languages, or use standard HTTP requests.
Installation
pip install log-harvestor-py
Usage
This package requires that you have a Log Harvestor account, and Forwarder's created. If you have not done this yet:
- Go to LogHarvestor.com
- Register for a new Account (This is free) Register
- Create a new Forwarder - Link
- Generate a Forwarder Token
Now you can use this forwarder token to send logs, by adding it to the config:
from logharvestor import Forwarder
pvt_token = 'your_forwarder_token'
fwdr = Forwarder(token=token, verbose=True)
fwdr.log('test', {"title": 'Hello World'})
Configuration
| Option | Default | Description |
|---|---|---|
| Token | "" | The JWT token assigned to your forwarder |
| ApiUrl | https://app.logharvestor.com/log | This should never change unless using proxies |
| Verbose | false | Verbose mode prints info to the console |
Examples
-
Configuring
from logharvestor import Forwarder
pvt_token := "your_forwarder_token"
fwdr = Forwarder(token=token, verbose=True)
-
Test Connection
from logharvestor import Forwarder
pvt_token := "your_forwarder_token"
fwdr = Forwarder(token=token, verbose=True)
success, res = fwdr.test_conn()
# `success` != True, the connection failed
# `res` contains the error that occured
# Error Examle (Invalid Token):
# False, <Response [401]>
-
Logging
from logharvestor import Forwarder
pvt_token := "your_forwarder_token"
fwdr = Forwarder(token=token, verbose=True)
# Strings
fwdr.log('test', msg="Hello World!")
# Numbers
fwdr.log('test', msg=123)
# Objects / Dicts
fwdr.log('test', msg={"a": 123, "b": "456", "c": "hello"})
# Arrays / Lists
fwdr.log('test', msg=["hello", "mars", "goodbye", "world"]))
fwdr.log('test', msg=[1, 2, 34, 567, 8, 90])
# Mixed
fwdr.log('test', msg={"a": 123, "b": {"c": "123", "d": {}}})
# Nested
fwdr.log('test', msg=[123, "abc", [1, 2, 3], {"question": "Hello?", "answer": "World!"}, {"question": "So long?", "answer": "Thanks for all the fish!"}])
Recomendations
- Keep your Logging specific, and consise. This makes searching faster and more accurate
- No need to add timestamps or info about the forwarder. This information is automatically included with the log.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file log-harvestor-py-1.0.0.tar.gz.
File metadata
- Download URL: log-harvestor-py-1.0.0.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a2367dff85897936a9dd77224305cf5a3ba78e02e8eb44fcf383ae98506aeba
|
|
| MD5 |
751d29f47072214bffc98065cc42c7f7
|
|
| BLAKE2b-256 |
e0998569a995d2268ad392b94b4790276d16479773b5d3eba3c42b1093805ec6
|
File details
Details for the file log_harvestor_py-1.0.0-py3-none-any.whl.
File metadata
- Download URL: log_harvestor_py-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a0dc6624a5446b8b3b4a4ea936bac0ace5f384480ddf20671b2137ef76fbfcd
|
|
| MD5 |
e34e010d970e1b5e736984fe8b2734b7
|
|
| BLAKE2b-256 |
24d35e78c6ef70be5b8721fa07ba7ac0167934607a8edb4815ab2d1a7a1a877e
|