Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DedupLogger ¶
type DedupLogger struct {
// contains filtered or unexported fields
}
DedupLogger wraps a time-ordered log set to allow batched logging of unique messages. Operations on DedupLogger are safe to use concurrently.
func NewLogger ¶
func NewLogger(ctx context.Context, host *provider.HostClient, urn resource.URN) *DedupLogger
NewLogger returns an initialized DedupLogger.
func (*DedupLogger) EnqueueMessage ¶
func (l *DedupLogger) EnqueueMessage(severity diag.Severity, s string)
EnqueueMessage adds a message to the log set but does not log it to the host.
func (*DedupLogger) GetNewMessages ¶
func (l *DedupLogger) GetNewMessages() []Message
GetNewMessages returns the list of new messages since last calling GetNewMessages.
func (*DedupLogger) LogMessage ¶
func (l *DedupLogger) LogMessage(msg Message)
LogMessage adds a message to the log set and flushes the queue to the host.
func (*DedupLogger) LogNewMessages ¶
func (l *DedupLogger) LogNewMessages()
LogNewMessages logs any new messages to the host.
type Message ¶
Message stores a log string and the severity for the log message.
func ErrorMessage ¶
ErrorMessage creates a Message with Severity set to Error.
func StatusMessage ¶
StatusMessage creates a Message with Severity set to Info.
func WarningMessage ¶
WarningMessage creates a Message with Severity set to Warning.
type Messages ¶
type Messages []Message
Messages is a slice of Message types.
func (Messages) MessagesWithSeverity ¶
MessagesWithSeverity returns Messages matching any of the provided Severity levels.
type TimeOrderedLogSet ¶
type TimeOrderedLogSet struct { Messages Messages // contains filtered or unexported fields }
TimeOrderedLogSet stores a temporally-ordered set of log messages.
func (*TimeOrderedLogSet) Add ¶
func (o *TimeOrderedLogSet) Add(msg Message)
Add appends a message to the time-ordered set.