log

package
v0.0.0-...-a4f8eeb Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2022 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergeEntry

func MergeEntry(a *logrus.Entry, b *logrus.Entry) *logrus.Entry

func New

func New() *logrus.Logger

New wraps logrus.

func NewEntry

func NewEntry(err error) *logrus.Entry

NewEntry wraps error compatible to logrus.

func SetJSONFormat

func SetJSONFormat()

SetJSONFormat sets log format to JSON.

func SetOutput

func SetOutput(out ...io.Writer)

SetOutput sets log output. If multiple writer provided, write to all of them. If no writer provided, do nothing.

func SetTextFormat

func SetTextFormat()

SetTextFormat sets log format to Text.

func ShowStack

func ShowStack()

ShowStack appends call stack to log. This operation cannot be undo.

Types

type F

type F = map[string]interface{}

type HCLogAdapter

type HCLogAdapter struct {
	Logger      logrus.FieldLogger
	PrependName string
	Args        []interface{}
}

func (*HCLogAdapter) CreateEntry

func (h *HCLogAdapter) CreateEntry(args []interface{}) *logrus.Entry

func (*HCLogAdapter) Debug

func (h *HCLogAdapter) Debug(msg string, args ...interface{})

Emit a message and key/value pairs at the DEBUG level

func (*HCLogAdapter) Error

func (h *HCLogAdapter) Error(msg string, args ...interface{})

Emit a message and key/value pairs at the ERROR level

func (*HCLogAdapter) ImpliedArgs

func (h *HCLogAdapter) ImpliedArgs() []interface{}

ImpliedArgs returns With key/value pairs

func (*HCLogAdapter) Info

func (h *HCLogAdapter) Info(msg string, args ...interface{})

Emit a message and key/value pairs at the INFO level

func (*HCLogAdapter) IsDebug

func (h *HCLogAdapter) IsDebug() bool

Indicate if DEBUG logs would be emitted. This and the other Is* guards

func (*HCLogAdapter) IsError

func (h *HCLogAdapter) IsError() bool

Indicate if ERROR logs would be emitted. This and the other Is* guards

func (*HCLogAdapter) IsInfo

func (h *HCLogAdapter) IsInfo() bool

Indicate if INFO logs would be emitted. This and the other Is* guards

func (*HCLogAdapter) IsTrace

func (h *HCLogAdapter) IsTrace() bool

Indicate if TRACE logs would be emitted. This and the other Is* guards are used to elide expensive logging code based on the current level.

func (*HCLogAdapter) IsWarn

func (h *HCLogAdapter) IsWarn() bool

Indicate if WARN logs would be emitted. This and the other Is* guards

func (*HCLogAdapter) Log

func (h *HCLogAdapter) Log(level hclog.Level, msg string, args ...interface{})

func (*HCLogAdapter) Name

func (h *HCLogAdapter) Name() string

Returns the Name of the logger

func (*HCLogAdapter) Named

func (h *HCLogAdapter) Named(name string) hclog.Logger

Create a logger that will prepend the name string on the front of all messages. If the logger already has a name, the new value will be appended to the current name. That way, a major subsystem can use this to decorate all it's own logs without losing context.

func (*HCLogAdapter) ResetNamed

func (h *HCLogAdapter) ResetNamed(name string) hclog.Logger

Create a logger that will prepend the name string on the front of all messages. This sets the name of the logger to the value directly, unlike Named which honor the current name as well.

func (*HCLogAdapter) SetLevel

func (h *HCLogAdapter) SetLevel(level hclog.Level)

Updates the level. This should affect all related loggers as well, unless they were created with IndependentLevels. If an implementation cannot update the level on the fly, it should no-op.

func (*HCLogAdapter) StandardLogger

func (h *HCLogAdapter) StandardLogger(opts *hclog.StandardLoggerOptions) *log.Logger

Return a value that conforms to the stdlib log.Logger interface

func (*HCLogAdapter) StandardWriter

func (h *HCLogAdapter) StandardWriter(opts *hclog.StandardLoggerOptions) io.Writer

Return a value that conforms to io.Writer, which can be passed into log.SetOutput()

func (*HCLogAdapter) Trace

func (h *HCLogAdapter) Trace(msg string, args ...interface{})

Emit a message and key/value pairs at the TRACE level

func (*HCLogAdapter) Warn

func (h *HCLogAdapter) Warn(msg string, args ...interface{})

Emit a message and key/value pairs at the WARN level

func (*HCLogAdapter) With

func (h *HCLogAdapter) With(args ...interface{}) hclog.Logger

Creates a sublogger that will always have the given key/value pairs

Jump to

Keyboard shortcuts

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