module

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

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

Go to latest
Published: Nov 17, 2022 License: MIT Imports: 8 Imported by: 4

Documentation

Index

Constants

View Source
const AllLevels = None | Info | Warn | Error

Variables

This section is empty.

Functions

func Catch

func Catch(ctx context.Context, hook Hook) context.Context

func EncodeLogValue

func EncodeLogValue(str string) string

func New

func New(name string, messages string) (L Logger, E ErrorFactory, m *Module)

Types

type ErrorFactory

type ErrorFactory func(name string, args ...interface{}) error

type Hook

type Hook func(m *Message) *Message
var GlobalHook Hook

func CtxCatch

func CtxCatch(ctx context.Context) (hook Hook)

type Level

type Level int
const (
	None Level = 2 << iota
	Info
	Warn
	Error
)

type Logger

type Logger interface {
	Info(name string, args ...interface{})
	Warn(name string, args ...interface{})
	Err(name string, args ...interface{})
	Log(level Level, name string, args ...interface{})

	Printf(desc string, args ...interface{})
	Print(desc string, args ...interface{})

	Report(err error)
}

type Message

type Message struct {
	Module string `json:"module"`
	Level  Level  `json:"level"`
	*errors.RichError
	Data map[string]interface{} `json:"data"`
}

type Module

type Module struct {
	Name string

	Mask   Level
	Hook   Hook
	Logger *log.Logger
	// contains filtered or unexported fields
}

func (*Module) Err

func (m *Module) Err(name string, args ...interface{})

func (*Module) Info

func (m *Module) Info(name string, args ...interface{})

func (*Module) Log

func (m *Module) Log(level Level, name string, args ...interface{})

func (*Module) Lookup

func (m *Module) Lookup(name string, args ...interface{}) (code int, desc string, link string, tail []interface{}, ctx context.Context, causedBy error)

func (*Module) NewError

func (m *Module) NewError(name string, args ...interface{}) error

func (*Module) Print

func (m *Module) Print(msg string, args ...interface{})

func (*Module) Printf

func (m *Module) Printf(pattern string, args ...interface{})

func (*Module) Report

func (m *Module) Report(err error)

func (*Module) Warn

func (m *Module) Warn(name string, args ...interface{})

Jump to

Keyboard shortcuts

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