flog

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package flog contains logging-related APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Formatter added in v1.1.0

type Formatter int

Formatter denotes a log formatter. Check the constants below for more information.

const (
	Text Formatter = iota
	TextWithoutTruncation
	JSON
)

func (Formatter) String added in v1.1.0

func (i Formatter) String() string

type Level

type Level int

Level denotes a log level. Check the constants below for more information.

const (
	Debug Level = iota
	Panic
)

func (Level) String

func (i Level) String() string

type Log added in v1.1.0

type Log struct {
	Level   string `json:"level,omitempty"`
	Message string `json:"msg,omitempty"`
	Time    string `json:"time,omitempty"`
}

Log defines the properties of every log message.

type Logger

type Logger interface {
	Debugf(format string, args ...interface{})
	Debugln(args ...interface{})
	Info(args ...interface{})
	Infof(format string, args ...interface{})
	Infoln(args ...interface{})
	Warnln(args ...interface{})
	Warnf(format string, args ...interface{})
	Error(args ...interface{})
	Errorf(format string, args ...interface{})
	Fatal(args ...interface{})
	SetLevel(level Level)
	SetFormatter(formatter Formatter)
}

Logger should be used to write any logs. No concrete implementations should be directly used.

type Logrus

type Logrus struct{}

Logrus implements the Logger interface.

func NewLogrus

func NewLogrus() *Logrus

NewLogrus returns a new logrus logger.

func (*Logrus) Debugf

func (l *Logrus) Debugf(format string, args ...interface{})

Debugf logs a message at level Debug.

func (*Logrus) Debugln

func (l *Logrus) Debugln(args ...interface{})

Debugln logs a message at level Debug.

func (*Logrus) Error

func (l *Logrus) Error(args ...interface{})

Error logs a message at level Error.

func (*Logrus) Errorf

func (l *Logrus) Errorf(format string, args ...interface{})

Errorf logs a message at level Error.

func (*Logrus) Fatal

func (l *Logrus) Fatal(args ...interface{})

Fatal logs a message at level Fatal.

func (*Logrus) Info

func (l *Logrus) Info(args ...interface{})

Info logs a message at level Info.

func (*Logrus) Infof

func (l *Logrus) Infof(format string, args ...interface{})

Infof logs a message at level Info.

func (*Logrus) Infoln

func (l *Logrus) Infoln(args ...interface{})

Infoln logs a message at level Info.

func (*Logrus) SetFormatter added in v1.1.0

func (l *Logrus) SetFormatter(formatter Formatter)

SetFormatter sets the formatter of the logger.

func (*Logrus) SetLevel

func (l *Logrus) SetLevel(level Level)

SetLevel sets the level of the logger.

func (*Logrus) Warnf added in v0.5.0

func (l *Logrus) Warnf(format string, args ...interface{})

Warnf logs a message at level Warn.

func (*Logrus) Warnln

func (l *Logrus) Warnln(args ...interface{})

Warnln logs a message at level Warn.

Jump to

Keyboard shortcuts

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