https://github.com/clever/kayvee-python
Kayvee translates an dictionary into a human and machine parseable string
https://github.com/clever/kayvee-python
Last synced: about 1 year ago
JSON representation
Kayvee translates an dictionary into a human and machine parseable string
- Host: GitHub
- URL: https://github.com/clever/kayvee-python
- Owner: Clever
- License: apache-2.0
- Created: 2014-10-02T23:10:49.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2024-09-23T18:26:21.000Z (almost 2 years ago)
- Last Synced: 2025-04-11T13:58:24.798Z (about 1 year ago)
- Language: Python
- Homepage:
- Size: 48.8 KB
- Stars: 2
- Watchers: 65
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# kayvee-python
Kayvee translates an dictionary into a human and machine parseable string, with a "json" format.
## Usage
The Kayvee formatter can be used directly or through the `kayvee.logger`
### kayvee formatter
```python
import kayvee as kv
print(kv.format(source="logger-test",
level=kv.INFO,
title="informational-log-title",
dict(id=name_id, context=context_str))
```
### kayvee.logger
```python
import kayvee.logger as logger
log = logger.Logger("logger-test")
log.info("information-log-title", dict(id=name_id, context=context_str))
# Pass global variables:
log = logger.Logger("logger-test", default_fields=dict("query"=query))
log.info("msg-title")
```
Other functions supported for structured logging:
* `Logger.debug`
* `Logger.info`
* `Logger.warn`
* `Logger.error`
* `Logger.critical`
Supported metrics:
* `Logger.counter`
* `Logger.gauge`
## Releasing a new version
When you merge changes for a new version:
- bump the `VERSION`
- update `CHANGELOG.md` explaining the changes
- after merging, run `publish.sh`
- requires you to install twine and wheel via `pip install `
- creates a git tag associating the version with the commit
- publishes the versioned package to pypi (Python package store)
If you have any issues, please work with `#oncall-infra`.