records

package
v0.0.0-...-7893cc3 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Record

type Record interface {
	// AddAttr returns a copy of this Record with the input Attr appended to the
	// existing ones
	AddAttr(a ...attr.Attr) Record
	// Attrs returns the slice of Attr associated to this Record
	Attrs() []attr.Attr
	// AttrLen returns the length of the slice of Attr in the Record
	AttrLen() int
	// Message returns the string Message associated to this Record
	Message() string
	// Time returns the time.Time timestamp associated to this Record
	Time() time.Time
	// Level returns the level.Level level associated to this Record
	Level() level.Level
}

Record interface describes the behavior that a Record should have

It expose getter methods for its elements, as well as two helper methods:

  • `AddAttr()` will return a copy of this Record with the input Attr appended to the existing ones
  • `AttrLen()` will return the length of the attributes in the record

func New

func New(t time.Time, lv level.Level, msg string, attrs ...attr.Attr) Record

New will return a Record based on the input time.Time `t`, level.Level `lv`, message string `msg` and attributes `attrs`.

If the input time is zero or Unix Time zero, it will set the Records time as now. If the level is nil, level.Info is set instead If there are nil attr.Attr values, they are dismissed

A Record is based on an immutable data structure

Jump to

Keyboard shortcuts

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