log

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2020 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogKey = "DennyLogger"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Formatter

type Formatter = logrus.Formatter

type JSONFormatter

type JSONFormatter = logrus.JSONFormatter

type Log

type Log struct {
	*logrus.Entry
	sync.Mutex
	// contains filtered or unexported fields
}

func New

func New(formatter ...Formatter) *Log

New return a new log object with log start time

func (*Log) AddLog

func (l *Log) AddLog(line string, format ...interface{}) *Log

AddLog add a new field to log with step = current step + 1

func (*Log) ToJsonString

func (l *Log) ToJsonString(input interface{}) string

ToJsonString convert an object into json string to beautify log return nil if marshalling error

func (*Log) WithField

func (l *Log) WithField(field string, value interface{}) *Log

WithField a a new key = value to log with key = field, value = value

func (*Log) WithFields

func (l *Log) WithFields(fields map[string]interface{}) *Log

WithFields add multiple key/value to log: key1 = value1, key2 = value2

type TextFormatter

type TextFormatter = logrus.TextFormatter

Jump to

Keyboard shortcuts

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