Simple fluentd logger library
Project description
Description
Fluentd logging library used to support standardized testing.
Programmatic example (Object logging)
from fluent import sender
from fluentd_logger.logger import Logger
tag = "agent"
app_label = "api"
logger = sender.FluentSender(tag=tag, host="localhost", port=24224)
service = Logger(logger)
messages = [
{
"A": "A1",
"B": "B1"
},
{
"C": "C1",
"D": "D1"
}
]
for message in messages:
service.emit(app_label=app_label, msg=message)
Package call pypi (File logging)
python -m fluentd_logger --file results.json --tag agent --label api --fluentd localhost:24224
Set --fluentd, --tag, --label options
There are 3 ways to set the above options
- Add an 'environment.properties' file containing the values. E.g.
FLUENTD_IP_PORT=localhost:24224 TAG=Agent LABEL=api
- Set the options through env vars. E.g.
export FLUENTD_IP_PORT=localhost:24224, export TAG=Agent export LABEL=4.2.1
- Set the values using this CLI interactively
Supported formats
Dict - one single test result (example)
{
"testName": "exampleTest",
"Db": "Mysql57",
"OS": "Centos7",
"logLocation": "http://logdatabase.com/exampleTest",
"startedat": "Sun Nov 1 10:16:52 EET 2020",
"endedat": "Sun Nov 1 10:22:52 EET 2020"
}
List of Dict(s) - multiple test result (example)
[
{
"testName": "exampleTest1",
"Db": "Mysql57",
"OS": "Centos7",
"logLocation": "http://logdatabase.com/exampleTest1",
"startedat": "Sun Nov 1 10:16:52 EET 2020",
"endedat": "Sun Nov 1 10:22:52 EET 2020"
},
{
"testName": "exampleTest2",
"Db": "Mysql57",
"OS": "Centos7",
"logLocation": "http://logdatabase.com/exampleTest2",
"startedat": "Sun Nov 1 10:22:52 EET 2020",
"endedat": "Sun Nov 1 10:30:52 EET 2020"
}
]
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
fluentd_logger-1.0.0.tar.gz
(5.1 kB
view hashes)
Built Distribution
Close
Hashes for fluentd_logger-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ecf49642a17a66be220d480721ed8fddf6f14dd1aef1889c5e61207a60426c42 |
|
MD5 | 634f3cbacaa0740dbc66765e478c8d24 |
|
BLAKE2b-256 | 660a9cb0849baf4f6f86e8f1202733c05067e210d8acc597d10460bba66b27ca |