messages

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2023 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Info messages are used just to inform the user and do not indicate that an action is required
	Info int = 0
	// Note messages are used similar to verbose messages and are used to keep the user up to date
	Note int = 1
	// Warn messages are used to notify the user that there was an error or that something didn't work as planned
	Warn int = 2
	// Debug messages are displayed while debugging the program and display a lot of information
	Debug int = 3
	// Success messages are you to notify the user that an action was completed without error
	Success int = 4
	// Plain messages have no color or other formatting applied and are used for edge cases
	Plain int = 5
)

Variables

This section is empty.

Functions

func DelayedMessage

func DelayedMessage(message UserMessage)

DelayedMessage is used to return messages to a client that are delayed or deferred for items like go routines

func SendBroadcastMessage

func SendBroadcastMessage(message UserMessage)

SendBroadcastMessage adds the input message to the channel for all registered clients

Types

type UserMessage

type UserMessage struct {
	Level   int       // Message level (i.e. Info, Debug, Verbose)
	Message string    // The text to be displayed
	Time    time.Time // Time the message was generated
	Error   bool      // Is the message the result of an error?
}

UserMessage is a structure that holds messages that will be presented to the user

func ErrorMessage

func ErrorMessage(message string) UserMessage

ErrorMessage returns a pre-formatted error message for an input string

func GetMessageForClient

func GetMessageForClient(clientID uuid.UUID) UserMessage

GetMessageForClient is used by a client to receive any queued messages for it

func JobMessage

func JobMessage(agentID uuid.UUID, message string) UserMessage

JobMessage returns a message showing that an agent job was successfully created

func Register

func Register(clientID uuid.UUID) UserMessage

Register lets the sever know that a client exists and that it can be sent messages

Jump to

Keyboard shortcuts

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