eventlogger

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2022 License: MIT Imports: 11 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEventLoggerContext

func NewEventLoggerContext(ctx context.Context, logger *Logger) context.Context

NewEventLoggerContext returns a context with the Logger embedded as a value

func StandardLogger

func StandardLogger(l *Logger) *log.Logger

StandardLogger returns a log.Logger that writes to l, or a default logger to stdout if l is nil

Types

type EventLoggerContextKey

type EventLoggerContextKey string

type Logger

type Logger struct {
	DL             persistence.EventLoggerDataLayer
	ID, DeliveryID uuid.UUID
	Sink           io.Writer
	// ExcludeID determines whether to omit the ID from log strings
	ExcludeID bool
}

Logger is an object that writes log lines to the database in an EventLog as well as to Sink

func GetLogger

func GetLogger(ctx context.Context) *Logger

GetLogger returns the Logger if present or a default logger that logs to stdout if not present

func (*Logger) Init

func (l *Logger) Init(webhook []byte, repo string, pr uint) error

Init initializes the EventLog object in the database. This must be called exactly once prior to any log lines. This method will persist the EventLog in the database with a null environment name

func (*Logger) Printf

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

Printf writes the formatted log line to the underlying Logger

func (*Logger) SetChartCompleted added in v0.7.5

func (l *Logger) SetChartCompleted(name string, status models.NodeChartStatus)

SetChartCompleted marks the chart install/upgrade for the named dependency to completed (name is assumed to exist) with status

func (*Logger) SetChartStarted added in v0.7.5

func (l *Logger) SetChartStarted(name string, status models.NodeChartStatus)

SetChartStarted marks the chart install/upgrade for the named dependency to started (name is assumed to exist) with status

func (*Logger) SetCompletedStatus added in v0.7.5

func (l *Logger) SetCompletedStatus(status models.EventStatus)

SetCompletedStatus marks the entire event as completed with status. This is intended to be called once at the end of event processing.

func (*Logger) SetEnvName

func (l *Logger) SetEnvName(name string) error

SetEnvName sets the environment name for this logger. Init must be called first.

func (*Logger) SetFailedStatus added in v0.8.0

func (l *Logger) SetFailedStatus(ce metahelm.ChartError)

SetFailedStatus marks the entire event as completed with a failed status. This is intended to be called once at the end of event processing.

func (*Logger) SetImageCompleted added in v0.7.5

func (l *Logger) SetImageCompleted(name string, err bool)

SetImageStarted marks the image build for the named dependency to completed (name is assumed to exist) and optionally with error if the build failed

func (*Logger) SetImageStarted added in v0.7.5

func (l *Logger) SetImageStarted(name string)

SetImageStarted marks the image build for the named dependency to started (name is assumed to exist)

func (*Logger) SetInitialStatus added in v0.7.5

func (l *Logger) SetInitialStatus(rc *models.RepoConfig, processingTime time.Duration)

SetInitialStatus sets up the initial progress tree and values according to the processed config, and records the time it took to do the config processing. This should be called no more than once per event.

func (*Logger) SetK8sNamespace added in v0.7.5

func (l *Logger) SetK8sNamespace(ns string)

func (*Logger) SetNewStatus added in v0.7.5

func (l *Logger) SetNewStatus(etype models.EventStatusType, envName string, rrd models.RepoRevisionData)

SetNewStatus creates a new empty event status of etype with only config.type, config.status and config.started set. This is intended to be called first and prior to config processing.

Jump to

Keyboard shortcuts

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