formatters

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ColorModeEnvName = "S1_LOGRUS_COLOR_MODE"

	DefaultTimeFormat = "2006-01-02 15:04:05.000 MST"
	DefaultTimeColor  = -1

	DefaultCallerColor  = terminal.ForegroundColorBrightBlue
	DefaultMessageColor = -1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Logrus

type Logrus struct {
	// On Windows combine it with "github.com/mattn/go-colorable".
	// For example:
	//	if runtime.GOOS == "windows" {
	//		log.SetOutput(colorable.NewColorableStdout())
	//	} else {
	//		log.SetOutput(os.Stdout)
	//	}
	EnableColors bool

	// TODO The feature is under development.
	// Set this to true to enable advanced coloring and message parsing.
	// Disable, if you have any performance issues.
	AdvancedColors bool

	// Set this to true, if you do not want to print timestamp,
	// e.g. it is added by external log system.
	SkipTime bool

	// Default is DefaultTimeFormat.
	TimeFormat string

	// Use values less than zero to disable timestamp coloring.
	// Use a valid terminal color to set up coloring.
	// Any other value (for example, 0) means DefaultTimeColor.
	// Ignored if coloring is not enabled for this formatter.
	TimeColor int

	// Use values less than zero to disable caller coloring.
	// Use a valid terminal color to set up coloring.
	// Any other value (for example, 0) means DefaultCallerColor.
	// Ignored if coloring is not enabled for this formatter.
	CallerColor int

	// Use values less than zero to disable caller coloring.
	// Use a valid terminal color to set up coloring.
	// Any other value (for example, 0) means DefaultMessageColor.
	// Ignored if coloring is not enabled for this formatter.
	MessageColor int
}

func (*Logrus) Format

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

Jump to

Keyboard shortcuts

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