https://github.com/omaskery/simple-logr
This little library intended to be a small, customisable component for use with the logr Go library.
https://github.com/omaskery/simple-logr
logger logging logging-library logr structured-logging
Last synced: 5 months ago
JSON representation
This little library intended to be a small, customisable component for use with the logr Go library.
- Host: GitHub
- URL: https://github.com/omaskery/simple-logr
- Owner: omaskery
- License: mit
- Created: 2021-07-11T17:48:37.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2023-03-30T02:58:17.000Z (over 3 years ago)
- Last Synced: 2024-06-21T06:25:38.291Z (about 2 years ago)
- Topics: logger, logging, logging-library, logr, structured-logging
- Language: Go
- Homepage:
- Size: 16.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Simple Logr
This little library intended to be a small, customisable component for use with the [logr][logr] Go library.
## Features
* Simple but configurable. Won't be very efficient, but easy to chop and change it to do what you want.
* Integrates well with custom error types like [github.com/pkg/errors][pkgerrs], able to extract stack traces and add
them to log messages.
## Design
It is broken down into two layers:
* The `Logger` which implements the `logr.LogSink` interface and is responsible for generating log `Entry` objects.
* `LogSink` implementations which are responsible for emitting log `Entry` objects, to wherever they please, formatted
however they like.
There are two provided log sinks:
* `DevelopmentLogSink` - intended for local development convenience, with optionally coloured output
* `JSONLogSink` - structured JSON logging, intended for production
This library hopes to be made of many composable pieces, such that any component that doesn't suit your requirements
can be omitted and replaced. To that end, it uses caller-provided functions where applicable to allow for considerable
flexibility before you are forced to resort writing a new LogSink.
[logr]: https://github.com/go-logr/logr
[pkgerrs]: https://github.com/pkg/errors