log

package module
v0.0.0-...-9ae8a3a Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2020 License: BSD-3-Clause Imports: 6 Imported by: 5

README

CrossTalk Log Build Status

Minimalist logging framework.

Documentation

Index

Constants

View Source
const (
	Ldate         = 1 << iota     // the date in the local time zone: 2009/01/23
	Ltime                         // the time in the local time zone: 01:23:23
	Lmicroseconds                 // microsecond resolution: 01:23:23.123123.  assumes Ltime.
	Llongfile                     // full file name and line number: /a/b/c/d.go:23
	Lshortfile                    // final file name element and line number: d.go:23. overrides Llongfile
	LUTC                          // if Ldate or Ltime is set, use UTC rather than the local time zone
	LstdFlags     = Ldate | Ltime // initial values for the standard logger
)
View Source
const (
	Debug = iota
	Info
	Warning
	Error
	Fatal
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context interface {
	context.Context
	Sugar
}

func NewContext

func NewContext(ctx context.Context, sugar Sugar) Context

type Level

type Level int

func ParseLevel

func ParseLevel(str string, preset Level) Level

func (Level) Tag

func (lv Level) Tag() string

type Logger

type Logger interface {
	Write(lv Level, payload interface{})
	Debug(payload interface{})
	Info(payload interface{})
	Warning(payload interface{})
	Error(payload interface{})
	Fatal(payload interface{})
}

func NewLogger

func NewLogger(writer Writer) Logger

type Sugar

type Sugar interface {
	Logger
	Writef(lv Level, format string, v ...interface{})
	Debugf(format string, v ...interface{})
	Infof(format string, v ...interface{})
	Warningf(format string, v ...interface{})
	Errorf(format string, v ...interface{})
	Fatalf(format string, v ...interface{})
}

func NewSugar

func NewSugar(logger Logger) Sugar

type Writer

type Writer func(level Level, payload interface{})

func Color

func Color(writer Writer) Writer

func GoLogger

func GoLogger(level Level, out io.Writer, prefix string, flag int) Writer

func JSON

func JSON(writer Writer) Writer

Jump to

Keyboard shortcuts

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