xlog

package
v0.0.0-...-953156a Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SetFormatter    = xLOG.SetFormatter
	SetOutput       = xLOG.SetOutput
	SetLevel        = xLOG.SetLevel
	SetReportCaller = xLOG.SetReportCaller
)

Functions

func CtxLog

func CtxLog(ctx context.Context) *logrus.Entry

ContextLog ContextLog

func GetLog

func GetLog() *logrus.Logger

Types

type JSONLoggerFormatter

type JSONLoggerFormatter struct {
}

func (JSONLoggerFormatter) Format

func (formatter JSONLoggerFormatter) Format(entry *logrus.Entry) ([]byte, error)

FormatDefault = "[${serviceName},${traceID},${spanID},${parentSpanID}][${pid}]"

timestamp := entry.Time.Format("2006-01-02 15:04:05")

return []byte(fmt.Sprintf("%s %s %s\n", timestamp, strings.ToUpper(entry.Level.String()), entry.Message)), nil

type MDReaderWriter

type MDReaderWriter struct {
	metadata.MD
}

func (MDReaderWriter) ForeachKey

func (c MDReaderWriter) ForeachKey(handler func(key, val string) error) error

func (MDReaderWriter) Set

func (c MDReaderWriter) Set(key, val string)

type Msg

type Msg struct {
	// contains filtered or unexported fields
}

func NewMsg

func NewMsg(str string) *Msg

func (*Msg) Add

func (h *Msg) Add(mstr interface{}) *Msg

func (*Msg) BR

func (h *Msg) BR() *Msg

func (*Msg) MarshalJSON

func (h *Msg) MarshalJSON() ([]byte, error)

func (*Msg) String

func (h *Msg) String() string

func (*Msg) UnmarshalJSON

func (h *Msg) UnmarshalJSON(data []byte) error

type StdWriter

type StdWriter struct {
}

func (*StdWriter) Write

func (h *StdWriter) Write(p []byte) (int, error)

type TextLoggerFormatter

type TextLoggerFormatter struct {
}

func (TextLoggerFormatter) Format

func (formatter TextLoggerFormatter) Format(entry *logrus.Entry) ([]byte, error)

FormatDefault = "[${serviceName},${traceID},${spanID},${parentSpanID}][${pid}]"

timestamp := entry.Time.Format("2006-01-02 15:04:05")

return []byte(fmt.Sprintf("%s %s %s\n", timestamp, strings.ToUpper(entry.Level.String()), entry.Message)), nil

Jump to

Keyboard shortcuts

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