Skip to main content

Lightweight logstash_formatter logging initializer

Project description

GIQLogging
==========

.. image:: https://travis-ci.org/graphiq-data/GIQLogging.svg?branch=master
:target: https://travis-ci.org/graphiq-data/GIQLogging

.. image:: https://badge.fury.io/py/giqlogging.svg
:target: https://badge.fury.io/py/giqlogging

GIQLogging is a lightweight logging initializer to promote standardized log formats across services. It wraps the functionality of ``logging`` with formatting provided by `Exoscale's <https://github.com/exoscale>`_ `python-logstash-formatter <https://github.com/exoscale/python-logstash-formatter>`_.

.. code-block:: python

import GIQLogging
logging = GIQLogging.init(logstash_type='servicename',
level=GIQLogging.INFO,
logpath='/path/to/log/output',
logger_name='servicename',
extra_fields={'foo': 'bar', 'hello': 'world'})
logging.info('log message')

Installation
------------

To install GIQLogging, simply:

.. code-block:: bash

pip install GIQLogging

Assumptions
-----------

- In Graphiq's case, GIQLogging is specifically intended for services to log JSON output to be picked up and visualized using an ELK (Elasticsearch, Logstash & Kibana) stack. As such, we require the ``logstash_type`` value to be set upon initialization. This value is placed as an ``extra_field`` and output to each log entry for later use by Logstash.
- The default ``level`` if one is not provided is ``logging.DEBUG``
- If a ``logpath`` is not provided the log will be directed to ``sys.stdout`
- ``logger_name`` is optional, only necessary if initializing multiple loggers
- ``extra_fields`` are optional

Issues
------

Please submit issues `here <https://github.com/graphiq-data/GIQLogging/issues>`_.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

GIQLogging-1.0.3.tar.gz (3.6 kB view details)

Uploaded Source

File details

Details for the file GIQLogging-1.0.3.tar.gz.

File metadata

  • Download URL: GIQLogging-1.0.3.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for GIQLogging-1.0.3.tar.gz
Algorithm Hash digest
SHA256 881237f09c0a7d9886dcc68bc0e32678efb107e8641f3d2e9d5f5976e4d30c84
MD5 32e9e7c70161b2ba8f832e2622c65bde
BLAKE2b-256 a639637cf538c4b10bae0c6a1c186211a861c2103e1143aec5ff036ed8a6c08d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page