cologger

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2018 License: MIT Imports: 6 Imported by: 0

README

cologger

color logger using logger

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultInfoColor  = color.New(color.FgCyan)
	DefaultDebugColor = color.New(color.FgMagenta)
	DefaultTimeColor  = color.New(color.FgYellow)
)

Default colors for info and debug messages and the time format string.

Functions

func WithDebugColor

func WithDebugColor(c *color.Color) func(*Logger)

WithDebugColor sets the color of the debug tag.

func WithInfoColor

func WithInfoColor(c *color.Color) func(*Logger)

WithInfoColor sets the color of the info tag.

func WithTimeColor

func WithTimeColor(c *color.Color) func(*Logger)

WithTimeColor sets the color of the time string.

func WithTimeFormat

func WithTimeFormat(tfmt string) func(*Logger)

WithTimeFormat sets the time format string.

func WithWriter

func WithWriter(out io.Writer) func(*Logger)

WithWriter sets the output writer.

Types

type Logger

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

Logger implements logger.Logger with colors.

func New

func New(args ...func(*Logger)) *Logger

New creates a Logger instance using stderr and the default settings.

func (*Logger) Debug

func (l *Logger) Debug(format string, args ...interface{})

Debug writes a debug message if it is enabled.

func (*Logger) Info

func (l *Logger) Info(format string, args ...interface{})

Info writes a debug message.

Jump to

Keyboard shortcuts

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