Skip to content

eisensheng/kaviar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

77ab934 · Dec 14, 2014

History

22 Commits
Nov 30, 2014
Dec 11, 2014
Dec 9, 2014
Dec 11, 2014
Nov 30, 2014
Dec 5, 2014
Dec 13, 2014
Nov 30, 2014
Dec 8, 2014
Nov 30, 2014
Dec 5, 2014
Nov 30, 2014
Nov 30, 2014
Dec 14, 2014
Dec 5, 2014

Repository files navigation

Kaviar

Continuous Integration Test Coverage Documentation Latest Version Python versions MIT License

Simplified event and data formatting and logging.

Kaviar aids developers in need of a convenient way to produce structured representation of key-value pairs for logging or representation with a fixed human and machine friendly syntax suited for later evaluation or just aesthetic reasons.

Example

Logging a certain event:

import logging
from kaviar import EventKvLoggerAdapter

logging.basicConfig(level=logging.DEBUG)
logger = EventKvLoggerAdapter.get_logger(__name__)
logger.info('NEW_CLIENT', client_id=42, peer_name='93.184.216.119')

Separating the event definition from actual logging:

import logging
from functools import partial
from kaviar import EventKvLoggerAdapter

logging.basicConfig(level=logging.DEBUG)
logger = EventKvLoggerAdapter.get_logger(__name__)

log_event = partial(logger.define_logger_func(logging.INFO,
                                              'server peer_name'),
                    'NEW_CLIENT')

log_event('example.org', '93.184.216.164')

About

Simplified event and data formatting and logging.

Resources

License

Stars

Watchers

Forks

Packages

No packages published