Documentation
¶
Index ¶
- type HistoricLogger
- type HistoricLoggerWrapper
- func (l *HistoricLoggerWrapper) Debug(msg ...interface{})
- func (l *HistoricLoggerWrapper) Error(msg ...interface{})
- func (l *HistoricLoggerWrapper) Info(msg ...interface{})
- func (l *HistoricLoggerWrapper) Messages(level int) []string
- func (l *HistoricLoggerWrapper) TotalCount(level int) int64
- func (l *HistoricLoggerWrapper) Verbose(msg ...interface{})
- func (l *HistoricLoggerWrapper) Warning(msg ...interface{})
- type SlackMessageAttachment
- type SlackMessageAttachmentFields
- type SlackWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HistoricLogger ¶
type HistoricLogger interface {
logging.LoggerInterface
Messages(level int) []string
TotalCount(level int) int64
}
HistoricLogger defines the interface for a logger that allows keeping the last N messages buffered and querying them
type HistoricLoggerWrapper ¶
type HistoricLoggerWrapper struct {
logging.LoggerInterface
// contains filtered or unexported fields
}
HistoricLoggerWrapper is an implementation of the HistoricLogger interface
func BuildFromConfig ¶
BuildFromConfig creates a logger from a config
func NewHistoricLoggerWrapper ¶
func NewHistoricLoggerWrapper(l logging.LoggerInterface, enabled [logLevelCount]bool, size int) *HistoricLoggerWrapper
NewHistoricLoggerWrapper constructs a new historic logger
func (*HistoricLoggerWrapper) Debug ¶
func (l *HistoricLoggerWrapper) Debug(msg ...interface{})
Debug writes a log message with debug level
func (*HistoricLoggerWrapper) Error ¶
func (l *HistoricLoggerWrapper) Error(msg ...interface{})
Error writes a log message with Error level
func (*HistoricLoggerWrapper) Info ¶
func (l *HistoricLoggerWrapper) Info(msg ...interface{})
Info writes a log message with info level
func (*HistoricLoggerWrapper) Messages ¶
func (l *HistoricLoggerWrapper) Messages(level int) []string
Messages returns the buffered messages for a specific level
func (*HistoricLoggerWrapper) TotalCount ¶
func (l *HistoricLoggerWrapper) TotalCount(level int) int64
TotalCount returns the total number of messages logged for a specific level
func (*HistoricLoggerWrapper) Verbose ¶
func (l *HistoricLoggerWrapper) Verbose(msg ...interface{})
Verbose writes a log message with verbose level
func (*HistoricLoggerWrapper) Warning ¶
func (l *HistoricLoggerWrapper) Warning(msg ...interface{})
Warning writes a log message with Warning level
type SlackMessageAttachment ¶
type SlackMessageAttachment struct {
Fallback string `json:"fallback"`
Text string `json:"text,omitempty"`
Pretext string `json:"pretext,omitempty"`
Color string `json:"color"` // Can either be one of 'good', 'warning', 'danger', or any hex color code
Fields []SlackMessageAttachmentFields `json:"fields"`
}
SlackMessageAttachment attach message struct
type SlackMessageAttachmentFields ¶
type SlackMessageAttachmentFields struct {
Title string `json:"title"`
Value string `json:"value"`
Short bool `json:"short"`
}
SlackMessageAttachmentFields attachment field struct
type SlackWriter ¶
type SlackWriter struct {
// contains filtered or unexported fields
}
SlackWriter writes messages to Slack user or channel. Implements io.Writer interface
func NewSlackWriter ¶
func NewSlackWriter(webhookURL string, channel string) *SlackWriter
NewSlackWriter constructs a slack writer
func (*SlackWriter) PostNow ¶
func (w *SlackWriter) PostNow(msg []byte, attachements []SlackMessageAttachment) (err error)
PostNow post a message directly to slack channel