Version: v0.0.0-...-8011c3a Latest Latest

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

Go to latest
Published: Sep 26, 2019 License: MIT Imports: 8 Imported by: 0



Package logrus represents implementations the interface logging.Log. The package is focused on the GELF Payload Specification logging format (http://docs.graylog.org/en/2.4/pages/gelf.html). Package implements adding to log the "timestamp" field, and gives the opportunity to specify fields: - "level"; - "short_message". Adding marked fields is implemented in "github.com/sirupsen/logrus", the capabilities of which are implemented in the package.



View Source
const (
	DebugLevel string = "debug"
	InfoLevel  string = "info"
	WarnLevel  string = "warning"
	ErrorLevel string = "error"
	FatalLevel string = "fatal"
	PanicLevel string = "panic"


This section is empty.


func New

func New(breaker chan context.Context, level string, outputs ...string) (logging.Logger, error)

New is a ContextLogger constructor. New takes argument outputs. Outputs is an optional argument in the slice the outputs to the files of the additional log. - If outputs is empty, then only std output on /dev/stderr is used. - If outputs is not empty, then values of the slice is used to output the log to an additional files along with the std output.


type ContextLogger

type ContextLogger struct {
	// contains filtered or unexported fields

ContextLogger implements log.Log.

func (*ContextLogger) AddHooks

func (cl *ContextLogger) AddHooks(hooks ...interface{}) error

AddHooks adds hooks from the cut of the hooks in the argument. If the hook does not match the interface log.Hook, returns an error.

func (*ContextLogger) FromContext

func (cl *ContextLogger) FromContext(ctx context.Context) logging.Entry

FromContext returns the Entry stored in a context, or nil if there isn't one.

func (*ContextLogger) GetValues

func (cl *ContextLogger) GetValues() logging.Values

GetValues provides the current context of the instance.

func (*ContextLogger) GracefulFatal

func (cl *ContextLogger) GracefulFatal(ctx context.Context)

GracefulFatal performs a soft fatal telling the fatal signal to the main application.

func (*ContextLogger) NewContext

func (cl *ContextLogger) NewContext(ctx context.Context) context.Context

NewContext returns the new context with entry.

func (*ContextLogger) WithValues

func (cl *ContextLogger) WithValues(v logging.Values) logging.Entry

WithValues wraps the logging.Values in log.Values and returns an instance of the entry in the form of interface logging.Entry. Provides an instance of an entry with primary implementation of fields.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL