logs

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: May 20, 2023 License: MIT Imports: 14 Imported by: 10

Documentation

Index

Constants

View Source
const (
	INFO  = "info"
	WARN  = "warn"
	ERROR = "error"
	DEBUG = "debug"
	SHOW  = "show"
	COST  = "cost"
)
View Source
const (
	PREFIX   = "prefix"
	FILELINE = "fileline"
	SUFFIX   = "suffix"
)
View Source
const LOG = "log"

Variables

This section is empty.

Functions

func Cost

func Cost(arg ...Any) func(...func() []Any)

func CostTime added in v0.6.4

func CostTime(cb func(time.Duration)) func()

func CreateFile added in v0.6.4

func CreateFile(p string) (io.WriteCloser, string, error)

func Debug

func Debug(arg ...Any)

func Disable added in v0.6.4

func Disable(status bool)

func Error

func Error(arg ...Any)

func FileLine

func FileLine(h Any, arg ...string) string

func FileLines added in v0.7.1

func FileLines(h Any) string

func FmtDuration

func FmtDuration(d time.Duration) string

func FmtInt

func FmtInt(i int) string

func FmtSize

func FmtSize(i uint64) string

func FmtTime

func FmtTime(t time.Time) string

func Format added in v0.6.4

func Format(str string, arg ...Any) string

func Info

func Info(arg ...Any)

func Infof added in v0.6.4

func Infof(str string, arg ...Any)

func Init

func Init(conf *conf.Conf, file file.File)

func Logger added in v0.6.4

func Logger(key string) func(...Any)

func Now

func Now() time.Time

func NowStamp

func NowStamp() int64

func PrintStack added in v0.6.4

func PrintStack()

func Println added in v0.6.4

func Println(arg ...Any)

func ReadFile added in v0.6.5

func ReadFile(p string) string

func Show

func Show(arg ...Any)

func Stack added in v0.6.4

func Stack(skip, deep int) string

func Warn

func Warn(arg ...Any)

Types

type Any added in v0.6.4

type Any = interface{}

type Log

type Log struct {
	Output   string
	Filter   []string
	Prefix   []string
	Notice   []string
	Out, Err io.WriteCloser
	// contains filtered or unexported fields
}

func New added in v0.6.4

func New(conf *conf.Conf, file file.File) *Log

func (*Log) Cost

func (log *Log) Cost(arg ...Any) func(...func() []Any)

func (*Log) Debug

func (log *Log) Debug(arg ...Any) bool

func (*Log) Debugf

func (log *Log) Debugf(str string, arg ...Any) bool

func (*Log) Error

func (log *Log) Error(arg ...Any)

func (*Log) Errorf

func (log *Log) Errorf(str string, arg ...Any)

func (*Log) Info

func (log *Log) Info(arg ...Any)

func (*Log) Infof

func (log *Log) Infof(str string, arg ...Any)

func (*Log) Logger added in v0.6.4

func (log *Log) Logger(key string) func(...Any)

func (*Log) Show

func (log *Log) Show(arg ...Any)

func (*Log) Warn

func (log *Log) Warn(arg ...Any)

func (*Log) Warnf

func (log *Log) Warnf(str string, arg ...Any)

type Meta added in v0.6.4

type Meta struct{ Key, Value string }

func FileLineMeta added in v0.6.4

func FileLineMeta(p Any) Meta

func PrefixMeta added in v0.6.4

func PrefixMeta(p string) Meta

func SuffixMeta added in v0.6.4

func SuffixMeta(p string) Meta

func ValueMeta added in v0.6.4

func ValueMeta(p string) Meta

func (Meta) String added in v0.6.4

func (s Meta) String() string

Jump to

Keyboard shortcuts

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