eventlog

package
v0.0.0-...-b9690c5 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2022 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigDeviceTypeJSON = "json"
	ConfigDeviceTypeText = "text"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	DeviceType string `json:"device_type"`
}

func (Config) Validate

func (c Config) Validate() error

type Device

type Device interface {
	WriteLogEntry(LogEntry) error
	WriteErrorEntry(ErrorEntry) error
}

type ErrorEntry

type ErrorEntry struct {
	Time int64 `json:"time"`

	Body ErrorEntryBody `json:"error"`
}

type ErrorEntryBody

type ErrorEntryBody struct {
	Code    int64  `json:"code"`
	Message string `json:"message"`
}

type Factory

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

func NewFactory

func NewFactory(config Config, logger boshlog.Logger) Factory

func (Factory) NewLog

func (f Factory) NewLog() Log

type JSONDevice

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

JSONDevice writes events as JSON log entries

func NewJSONDevice

func NewJSONDevice(writer io.Writer) JSONDevice

func (JSONDevice) WriteErrorEntry

func (d JSONDevice) WriteErrorEntry(entry ErrorEntry) error

func (JSONDevice) WriteLogEntry

func (d JSONDevice) WriteLogEntry(entry LogEntry) error

type Log

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

func NewLog

func NewLog(device Device, logger boshlog.Logger) Log

func (Log) BeginStage

func (l Log) BeginStage(name string, total int) *Stage

func (Log) WriteErr

func (l Log) WriteErr(err error)

func (Log) WriteLogEntryNoErr

func (l Log) WriteLogEntryNoErr(entry LogEntry)

type LogEntry

type LogEntry struct {
	Time int64 `json:"time"`

	Stage string   `json:"stage"`
	Task  string   `json:"task"`
	Tags  []string `json:"tags"`

	Total int `json:"total"`
	Index int `json:"index"`

	State    string `json:"state"`
	Progress int    `json:"progress"`

	// Might contain error key
	Data map[string]interface{} `json:"data,omitempty"`
}

type Stage

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

func (*Stage) BeginTask

func (s *Stage) BeginTask(name string) Task

type Task

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

func (Task) End

func (t Task) End(err error) error

func (Task) Start

func (t Task) Start()

type TextDevice

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

TextDevice writes events in user friendly format

func NewTextDevice

func NewTextDevice(writer io.Writer) TextDevice

func (TextDevice) WriteErrorEntry

func (d TextDevice) WriteErrorEntry(entry ErrorEntry) error

func (TextDevice) WriteLogEntry

func (d TextDevice) WriteLogEntry(entry LogEntry) error

Jump to

Keyboard shortcuts

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