message

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Level

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

type Repository

type Repository interface {
	Add(message *UserMessage)
	Get() *UserMessage
}

type UserMessage

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

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

func NewErrorMessage

func NewErrorMessage(err error) *UserMessage

NewErrorMessage is a factory that builds and returns a UserMessage structure

func NewUserMessage

func NewUserMessage(level Level, message string) *UserMessage

NewUserMessage is a factory that builds and returns a UserMessage structure The Time field is set to the current time as UTC Use the NewErrorMessage factory to create an error message

func NewUserMessageFull

func NewUserMessageFull(level Level, message string, timestamp time.Time, isError bool) *UserMessage

NewUserMessageFull is a factory that builds and returns a UserMessage structure Typically used to convert a pb.Message structure to a UserMessage structure so that the timestamp can be transferred

func (*UserMessage) Error

func (um *UserMessage) Error() bool

func (*UserMessage) Level

func (um *UserMessage) Level() Level

func (*UserMessage) Message

func (um *UserMessage) Message() string

func (*UserMessage) Timestamp

func (um *UserMessage) Timestamp() time.Time

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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