carte

package module
v0.0.0-...-449ecf2 Latest Latest
Warning

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

Go to latest
Published: May 17, 2020 License: MIT Imports: 9 Imported by: 0

README

carte

Minimal Json logger that uses Severities for customizability

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// StdOut
	Info = &severity{
		name:   []byte("INF"),
		writer: os.Stdout,
	}
	Debug = &severity{
		name:   []byte("DBG"),
		writer: os.Stdout,
	}

	// StdErr
	Warn = &severity{
		name:   []byte("WRN"),
		writer: os.Stderr,
	}
	Error = &severity{
		name:   []byte("ERR"),
		writer: os.Stderr,
	}
	Critical = &severity{
		name:   []byte("CRT"),
		writer: os.Stderr,
	}
	Panic = &severity{
		name:   []byte("PNC"),
		writer: os.Stderr,
	}
)

Predefined severity levels

View Source
var (
	ErrLocationWasNil = errors.New("received a nil time.Location")
)

Errors

Functions

func NewSeverity

func NewSeverity(name []byte, w io.Writer, hook func([]byte)) *severity

func SetAllHooks

func SetAllHooks(hook func([]byte))

func SetAllWriters

func SetAllWriters(w io.Writer)

func SetDateFormat

func SetDateFormat(format string)

func SetHookFor

func SetHookFor(hook func([]byte), severities ...severity)

SetWriters sets every severity to a single io.Writer

func SetTimezone

func SetTimezone(tz *time.Location) error

func SetWriters

func SetWriters(w io.Writer, severities ...severity)

SetWriters sets every severity to a single io.Writer

Types

type Jable

type Jable struct {
	Name  string
	Value string
}

func (*Jable) Json

func (j *Jable) Json() (string, string)

type Jsonable

type Jsonable interface {
	Json() (name string, value string)
}

Jump to

Keyboard shortcuts

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