griprus

package module
v0.0.0-...-ce6e130 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

README

================================================================
``griprus`` -- Grip and Logrus Bidirectional Compatibility Layer
================================================================

gripslog is a shim layer between Grip and Slog, allowing libraries written
with one logger to exist within applications that use the other, and also use
the underlying fundamentals (Senders and Loggers) within either higher level
interfaces.

The translation between message.Composers and logrus.Entry (and between
level.Priority and logrus.Level) is not lossless, logrus stack data is not
converted to grip equivalents, and grip has a more fine grained level system;
however, for the most common cases the conversion is quite robust.

Documentation

Overview

Package griprus provides a bidirectional compatibility layer between grip and logrus.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertEntry

func ConvertEntry(e *logrus.Entry) message.Composer

ConvertEntry produces converts logrus entry into the equivalent grip message. The implementation uses grip's "Fields" message type.

func ConvertLevel

func ConvertLevel(l logrus.Level) level.Priority

ConvertLevel converts a logrus level to a grip priority.

func ConvertMessage

func ConvertMessage(logger *logrus.Logger, m message.Composer) *logrus.Entry

ConvertMessage takes a grip message instance and converts it to the equivalent logrus.Entry.

func ConvertPriority

func ConvertPriority(p level.Priority) logrus.Level

ConvertPriority takes a grip Priorty and converts it into the equivalent logrus level.

func NewLogger

func NewLogger(s send.Sender) *logrus.Logger

NewLogger produces a logger that writes all logs to the underlying grip Sender, configured as an io.Writer.

func NewSender

func NewSender(logger *logrus.Logger) send.Sender

NewSender produces a Sender implementation that wraps a logger implementation. The name associated with the sender is derived from the global grip logger name, which is probably the process name.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL