log

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2021 License: Apache-2.0 Imports: 1 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package log defines the logger interfaces used by pulsar client. Users can leverage these interfaces to provide a customized logger implementation.

The Logger and Entry interfaces defined here are inspired by sirupsen/logrus, both logrus and zap logging libraries are good resources to learn how to implement a effective logging library.

Besides the interfaces, this log library also provides an implementation based on logrus, and a No-op one as well.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry interface {
	WithFields(fields Fields) Entry
	WithField(name string, value interface{}) Entry

	Debug(args ...interface{})
	Info(args ...interface{})
	Warn(args ...interface{})
	Error(args ...interface{})

	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Warnf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
}

Entry describes the interface for the logger entry.

type Fields

type Fields map[string]interface{}

Fields type, used to pass to `WithFields`.

type Logger

type Logger interface {
	SubLogger(fields Fields) Logger

	WithFields(fields Fields) Entry
	WithField(name string, value interface{}) Entry
	WithError(err error) Entry

	Debug(args ...interface{})
	Info(args ...interface{})
	Warn(args ...interface{})
	Error(args ...interface{})

	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Warnf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
}

Logger describes the interface that must be implemeted by all loggers.

func DefaultNopLogger

func DefaultNopLogger() Logger

DefaultNopLogger returns a nop logger.

func NewLoggerWithLogrus

func NewLoggerWithLogrus(logger *logrus.Logger) Logger

NewLoggerWithLogrus creates a new logger which wraps the given logrus.Logger

Jump to

Keyboard shortcuts

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