pulse-logging 2.3.1

Last updated:

0 purchases

pulse-logging 2.3.1 Image
pulse-logging 2.3.1 Images
Add to Cart

Description:

pulselogging 2.3.1

Pulse Logging - Python
Installation
Installing package via pip
pip install pulse-logging

Alternatively you could install by running the setup script.
python setup.py install

Usage
Log Appender
import logging
from pulse import PulseHandler
from pulse import PulseFormatter

pulse_handler = PulseHandler("http://host.com:9001/v2/events/app")
pulse_handler.setFormatter(PulseFormatter())
pulse_handler.setLevel(logging.WARNING)
logger = logging.getLogger(__name__)
logger.setLevel(logging.WARNING)
logger.addHandler(pulse_handler)

try:
raise ValueError
except ValueError as e:
logger.exception("Bad stuff")

Logging Configuration File Example
logging.ini file contents
[loggers]
keys=root

[handlers]
keys=pulse_handler

[formatters]
keys=pulse_formatter

[logger_root]
level=WARNING
handlers=pulse_handler

[handler_pulse_handler]
class=handlers.PulseHandler
level=WARNING
formatter=pulse_formatter
args=("http://host.com:9001/v2/events/app")

[formatter_pulse_formatter]
class=pulse.PulseFormatter


main.py file contents
import logging
from logging.config import fileConfig

fileConfig("logging.ini")
logger = logging.getLogger()

try:
raise ValueError
except ValueError as e:
logger.exception("Bad stuff")

Writing Metrics
from pulse import MetricWriter

writer = MetricWriter("http://host.com:9001/v1/metrics", "kudu_table_name")
writer.gauge("key1", "r2", 0.952)

writer.close()

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.