Skip to content

MapColonies/json-logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

json-logger

Installation

pip3 install mapcoloniesjsonlogger

Usage Example

from MapColoniesJSONLogger.logger import generate_logger
import os

log = generate_logger('service_name', log_level='INFO', handlers=[{'type': 'rotating_file', 'path': '/var/log/service.log'}])
log.info('basic message')
log.info('message with extra fields', extra={'extra.field': 'extra_value', 'service': 'some_service'}) # supports nesting of fields
log.debug('will not be in a file')

Configuration Example

The configuration dict bellow is used by the package. For more information on logging configuration see logging.config docs

About

python json logger

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages