consola

package module
v0.0.0-...-e33ef78 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2018 License: MIT Imports: 4 Imported by: 0

README

consola

Visually pleasing logging formatter for Logrus

GoDoc

Documentation

Overview

consola is a simple package for printing better looking Logrus log messages to the console.

Example
log := logrus.New()
// Set the logrus formatter to a new consola.Formatter
log.Formatter = Formatter{}

log.Info("Hello, World!")
Output:

Index

Examples

Constants

View Source
const (
	Red      = "\x1b[31m"
	Yellow   = "\x1b[33m"
	Green    = "\x1b[32m"
	Rst      = "\x1b[0m"
	DarkGrey = "\x1b[90m"
)

Terminal color constants

Variables

View Source
var DefaultFieldSeparator = ":"
View Source
var DefaultTimeLayout = "15:04:05 02/01"

Functions

This section is empty.

Types

type Formatter

type Formatter struct {
	// Sets the message time format
	TimeLayout string

	// If set to true then do not print extra fields
	ExcludeFields bool

	// String value used to separate log fields
	FieldSeparator string

	PrimaryPrefixField string

	SecondaryPrefixField string

	// Enable color
	Color bool
}

func (Formatter) Format

func (f Formatter) Format(e *logrus.Entry) ([]byte, error)

Jump to

Keyboard shortcuts

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