pubsub

package
v0.0.0-...-432215d Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2015 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusCached       = "CACHED"
	StatusExecStart    = "EXEC"
	StatusExecFinished = "FINISHED"
)
View Source
const (
	MessageTasksPrecompile     = "urknall.tasks.precompile"
	MessageUrknallInternal     = "urknall.internal"
	MessageCleanupCacheEntries = "urknall.cleanup_cache_entries"
	MessageTasksProvision      = "urknall.tasks.provision.list"
	MessageTasksProvisionTask  = "urknall.tasks.provision.task"
)

Variables

This section is empty.

Functions

func OpenLogger

func OpenLogger(w io.Writer) io.Closer

Create a logging facility for urknall using urknall's default formatter. Note that this resource must be closed afterwards!

func RegisterPubSub

func RegisterPubSub(ps *pubsub.PubSub)

Register your own instance of the PubSub type to handle logging yourself.

Types

type Message

type Message struct {
	Key string // Key the message is sent with.

	ExecStatus string // Urknall status (executed or cached).
	Message    string // The message to be logged.

	Hostname string // IP of the host a command is run.

	TaskName     string // Name of the package currently being executed.
	TaskChecksum string // Hash of a task.

	PublishedAt  time.Time     // When was the message published.
	StartedAt    time.Time     // When was the message created.
	Duration     time.Duration // How long did the action take (delta from message creation and publishing).
	TotalRuntime time.Duration // Timeframe of the action (might be larger than the message's).

	Stream string // Stream a line appeared on.
	Line   string // Line that appeared on a stream.

	InvalidatedCacheEntries []string // List of invalidated cache entries (urknall caching).

	Error error  // Error that occured.
	Stack string // The stack trace in case of a panic.
}

Urknall uses the http://github.com/dynport/dgtk/pubsub package for logging (a publisher-subscriber pattern where defined messages are sent to subscribers). This is the message type urknall will send out. If you handle logging yourself this type provides the required information. Please note that this message is sent in different context's and not all fields will be set all the time.

func (*Message) IsStderr

func (message *Message) IsStderr() bool

Predicated to verify whether the given message was sent via stderr.

func (Message) Publish

func (message Message) Publish(key string)

Publish the message with the given key postfix.

func (Message) PublishError

func (message Message) PublishError(e error)

Publish the message with the given error.

func (*Message) PublishPanic

func (message *Message) PublishPanic(e error)

Publish the message with the given error and create a stacktrace.

Jump to

Keyboard shortcuts

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