dflog

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultLogTimeFormat = "2006-01-02 15:04:05.000"

DefaultLogTimeFormat defines the timestamp format.

Variables

This section is empty.

Functions

func AddConsoleLog

func AddConsoleLog(Logger *logrus.Logger)

AddConsoleLog will add a ConsoleLog into Logger's hooks. It will output logs to console when Logger's outputting logs.

func CreateLogger

func CreateLogger(logPath string, logName string, logLevel string, sign string) (*logrus.Logger, error)

CreateLogger creates a Logger.

func InitConsoleLog

func InitConsoleLog(debug bool, sign string)

InitConsoleLog initializes console logger for process. console log will output the dfget client's log in console/terminal for debugging usage.

func InitLog

func InitLog(debug bool, logFilePath string, sign string) error

InitLog initializes the file logger for process. logfile is used to stored generated log in local filesystem.

func IsDebug

func IsDebug(level logrus.Level) bool

IsDebug returns the log level is debug.

Types

type ConsoleHook

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

ConsoleHook shows logs on console.

func (*ConsoleHook) Fire

func (ch *ConsoleHook) Fire(entry *logrus.Entry) error

Fire implements Hook#Fire.

func (*ConsoleHook) Levels

func (ch *ConsoleHook) Levels() []logrus.Level

Levels implements Hook#Levels().

type DragonflyFormatter

type DragonflyFormatter struct {
	// TimestampFormat sets the format used for marshaling timestamps.
	TimestampFormat string
	Sign            string
}

DragonflyFormatter customizes the dragonfly log format.

func (*DragonflyFormatter) Format

func (f *DragonflyFormatter) Format(entry *logrus.Entry) ([]byte, error)

Format implements Formatter#Format.

Jump to

Keyboard shortcuts

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