log

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2022 License: Apache-2.0 Imports: 14 Imported by: 3

Documentation

Index

Constants

View Source
const LogTimeFormat = "2006-01-02T15:04:05.000-0700"

LogTimeFormat is a date-time format to be displayed in the log output

Variables

This section is empty.

Functions

This section is empty.

Types

type Entries added in v1.6.0

type Entries struct {
	Data     []Entry `json:"data"`
	ShowNode bool    `json:"-"`
	Extr     bool    `json:"-"`
}

func Get added in v1.6.0

func Get(cn *mongo.Collection, r *LogRequest, limit int64, exactSeverity bool) (*Entries, error)

func (Entries) MarshalJSON added in v1.6.0

func (e Entries) MarshalJSON() ([]byte, error)

func (Entries) String added in v1.6.0

func (e Entries) String() (s string)

type Entry added in v1.6.0

type Entry struct {
	ObjID   primitive.ObjectID `bson:"-" json:"-"` // to get sense of mgs total ordering while reading logs
	TS      int64              `bson:"ts" json:"ts"`
	Tns     int                `bson:"ns" json:"-"`
	TZone   int                `bson:"tz" json:"-"`
	LogKeys `bson:",inline" json:",inline"`
	Msg     string `bson:"msg" json:"msg"`
}

func (*Entry) String added in v1.6.0

func (e *Entry) String() (s string)

func (*Entry) StringNode added in v1.6.0

func (e *Entry) StringNode() (s string)

type Event

type Event struct {
	// contains filtered or unexported fields
}

Event provides logging for some event (backup, restore)

func (*Event) Debug

func (e *Event) Debug(msg string, args ...interface{})

func (*Event) Error

func (e *Event) Error(msg string, args ...interface{})

func (*Event) Fatal

func (e *Event) Fatal(msg string, args ...interface{})

func (*Event) Info

func (e *Event) Info(msg string, args ...interface{})

func (*Event) Warning

func (e *Event) Warning(msg string, args ...interface{})

type LogKeys

type LogKeys struct {
	Severity Severity            `bson:"s" json:"s"`
	RS       string              `bson:"rs" json:"rs"`
	Node     string              `bson:"node" json:"node"`
	Event    string              `bson:"e" json:"e"`
	ObjName  string              `bson:"eobj" json:"eobj"`
	Epoch    primitive.Timestamp `bson:"ep,omitempty" json:"ep,omitempty"`
	OPID     string              `bson:"opid,omitempty" json:"opid,omitempty"`
}

type LogRequest

type LogRequest struct {
	TimeMin time.Time
	TimeMax time.Time
	LogKeys
}

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

func New

func New(cn *mongo.Collection, rs, node string) *Logger

func (*Logger) Debug

func (l *Logger) Debug(event string, obj, opid string, epoch primitive.Timestamp, msg string, args ...interface{})

func (*Logger) Error

func (l *Logger) Error(event string, obj, opid string, epoch primitive.Timestamp, msg string, args ...interface{})

func (*Logger) Fatal

func (l *Logger) Fatal(event string, obj, opid string, epoch primitive.Timestamp, msg string, args ...interface{})

func (*Logger) Info

func (l *Logger) Info(event string, obj, opid string, epoch primitive.Timestamp, msg string, args ...interface{})

func (*Logger) NewEvent

func (l *Logger) NewEvent(typ, name, opid string, epoch primitive.Timestamp) *Event

func (*Logger) Output

func (l *Logger) Output(e *Entry) error

func (*Logger) PauseMgo added in v1.7.0

func (l *Logger) PauseMgo()

func (*Logger) Printf

func (l *Logger) Printf(msg string, args ...interface{})

func (*Logger) ResumeMgo added in v1.7.0

func (l *Logger) ResumeMgo()

func (*Logger) Warning

func (l *Logger) Warning(event string, obj, opid string, epoch primitive.Timestamp, msg string, args ...interface{})

type Severity

type Severity int
const (
	Fatal Severity = iota
	Error
	Warning
	Info
	Debug
)

func (Severity) String

func (s Severity) String() string

Jump to

Keyboard shortcuts

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