log

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2023 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debugf

func Debugf(c ctx.C, f string, args ...any)

func Errorf

func Errorf(c ctx.C, f string, args ...any)

func Infof

func Infof(c ctx.C, f string, args ...any)

func Warnf

func Warnf(c ctx.C, f string, args ...any)

func WithLogger

func WithLogger(c ctx.C, logger func(Line)) ctx.C

return a new context with a custom logger attached to it

func WithLoggerAndHelper

func WithLoggerAndHelper(c ctx.C, logger func(Line), helper func()) ctx.C

same as WithLogger(), but it has an extra helper function mostly used for testing

Types

type Line

type Line struct {
	Level   string    `json:"level,omitempty"`
	Src     string    `json:"src,omitempty"`
	Time    time.Time `json:"time"`
	Message string    `json:"message"`
	Tags    Tags      `json:"tags,omitempty"`
}

func (Line) JSON

func (this Line) JSON() string

func (Line) Log

func (at Line) Log(c ctx.C)

TODO(oha) needed?

type Loggable

type Loggable interface {
	LogAs(*Tags) any
}

type RedactedString

type RedactedString string

simple string that will log itself as "***"

func (RedactedString) LogAs

func (this RedactedString) LogAs(*Tags) any

type Tags

type Tags map[string]ctx.JSON

Jump to

Keyboard shortcuts

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