text

package
v0.0.0-...-667e50d Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2016 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package text implements a development-friendly textual handler.

Index

Constants

This section is empty.

Variables

View Source
var Colors = [...]int{
	log.DebugLevel: gray,
	log.InfoLevel:  blue,
	log.WarnLevel:  yellow,
	log.ErrorLevel: red,
	log.FatalLevel: red,
}

Colors mapping.

View Source
var Default = New(os.Stderr)

Default handler outputting to stderr.

View Source
var Strings = [...]string{
	log.DebugLevel: "DEBUG",
	log.InfoLevel:  "INFO",
	log.WarnLevel:  "WARN",
	log.ErrorLevel: "ERROR",
	log.FatalLevel: "FATAL",
}

Strings mapping.

Functions

This section is empty.

Types

type ColorMode

type ColorMode int

ColorMode determines whether colors are used.

const (
	// AutoColor automatically determines if a color is used from
	// checking the file descriptor.
	//
	// Color is only used when the underlying io.Writer is an *os.File.
	AutoColor ColorMode = iota

	// ForceColor forces colors to be used. The io.Writer can be any type.
	ForceColor

	// NoColor forces colors to not be used.
	NoColor
)

type Handler

type Handler struct {
	ColorMode ColorMode
	Writer    io.Writer
	// contains filtered or unexported fields
}

Handler implementation.

func New

func New(w io.Writer) *Handler

New creates a new handler with io.Writer.

func (*Handler) HandleLog

func (h *Handler) HandleLog(e *log.Entry) error

HandleLog implements log.Handler.

Jump to

Keyboard shortcuts

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