ecslogs

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2020 License: MIT Imports: 11 Imported by: 8

README

ecs-logs-go CircleCI GoDoc

Set of Go packages to integrate the ecs-logs format with other logging packages.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GuessCaller

func GuessCaller(skip int, maxDepth int, ignorePackages ...string) (pc uintptr, ok bool)

Types

type Event

type Event struct {
	Level   Level     `json:"level"`
	Time    time.Time `json:"time"`
	Info    EventInfo `json:"info"`
	Data    EventData `json:"data"`
	Message string    `json:"message"`
}

func Eprint

func Eprint(level Level, args ...interface{}) Event

func Eprintf

func Eprintf(level Level, format string, args ...interface{}) Event

func MakeEvent

func MakeEvent(level Level, message string, values ...interface{}) Event

func (Event) Bytes

func (e Event) Bytes() []byte

func (Event) String

func (e Event) String() string

type EventData

type EventData map[string]interface{}

func (EventData) Bytes

func (e EventData) Bytes() []byte

func (EventData) String

func (e EventData) String() string

type EventError

type EventError struct {
	Type          string      `json:"type,omitempty"`
	Error         string      `json:"error,omitempty"`
	Errno         int         `json:"errno,omitempty"`
	Stack         interface{} `json:"stack,omitempty"`
	OriginalError error       `json:"origError,omitempty"`
}

func MakeEventError

func MakeEventError(err error) EventError

type EventInfo

type EventInfo struct {
	Host   string       `json:"host,omitempty"`
	Source string       `json:"source,omitempty"`
	ID     string       `json:"id,omitempty"`
	PID    int          `json:"pid,omitempty"`
	UID    int          `json:"uid,omitempty"`
	GID    int          `json:"gid,omitempty"`
	Errors []EventError `json:"errors,omitempty"`
}

func (EventInfo) Bytes

func (e EventInfo) Bytes() []byte

func (EventInfo) String

func (e EventInfo) String() string

type FuncInfo

type FuncInfo struct {
	File string
	Func string
	Line int
}

func GetFuncInfo

func GetFuncInfo(pc uintptr) (info FuncInfo, ok bool)

func (FuncInfo) String

func (info FuncInfo) String() string

type Level

type Level int
const (
	NONE Level = iota
	EMERG
	ALERT
	CRIT
	ERROR
	WARN
	NOTICE
	INFO
	DEBUG
	TRACE
)

func MakeLevel

func MakeLevel(p int) Level

func ParseLevel

func ParseLevel(s string) (lvl Level, err error)

func (Level) Get

func (lvl Level) Get() interface{}

func (Level) GoString

func (lvl Level) GoString() string

func (*Level) MarshalJSON

func (lvl *Level) MarshalJSON() (b []byte, err error)

func (Level) MarshalText

func (lvl Level) MarshalText() (b []byte, err error)

func (Level) MarshalYAML

func (lvl Level) MarshalYAML() (b []byte, err error)

func (Level) Priority

func (lvl Level) Priority() int

func (*Level) Set

func (lvl *Level) Set(s string) (err error)

func (Level) String

func (lvl Level) String() string

func (*Level) UnmarshalJSON

func (lvl *Level) UnmarshalJSON(b []byte) (err error)

func (*Level) UnmarshalText

func (lvl *Level) UnmarshalText(b []byte) (err error)

func (*Level) UnmarshalYAML

func (lvl *Level) UnmarshalYAML(f func(interface{}) error) (err error)

type Logger

type Logger interface {
	Log(Event) error
}

func NewLogger

func NewLogger(w io.Writer) Logger

type LoggerFunc

type LoggerFunc func(Event) error

func (LoggerFunc) Log

func (f LoggerFunc) Log(e Event) error

type ParseLevelError

type ParseLevelError struct {
	Level string
}

func (ParseLevelError) Error

func (e ParseLevelError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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