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 python-logstash-formatter.
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')To install GIQLogging, simply:
pip install GIQLogging- 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_typevalue to be set upon initialization. This value is placed as anextra_fieldand output to each log entry for later use by Logstash. - The default
levelif one is not provided islogging.DEBUG - If a
logpathis not provided the log will be directed tosys.stdout logger_nameis optional, only necessary if initializing multiple loggersextra_fieldsare optional
Please submit issues here.