mattermost

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultFormatter

func DefaultFormatter(entry log.Entry) string

DefaultFormatter is the default entry formatter used.

Types

type Writer

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

Writer is a log.EntryWriter that will send the log to mattermost on a specific channel.

func NewWriter

func NewWriter(http http.Client, hookURL string, opts ...WriterOpt) *Writer

NewWriter returns a new writer. When no channel is given, it will send the message to the default channel (general). When no formatter is given, it will take the default formatter.

func (*Writer) WriteEntry

func (w *Writer) WriteEntry(entry log.Entry)

WriteEntry implements the log.EntryWriter interface.

type WriterOpt

type WriterOpt func(writer *Writer)

WriterOpt is able to configure a Writer.

func Channel

func Channel(channel string) WriterOpt

Channel set a specific channel where the logs will be sent.

func Formatter

func Formatter(formatter func(log.Entry) string) WriterOpt

Formatter set an entry formatter to format the message sent to mattermost. If None

func OnError

func OnError(callback func(error)) WriterOpt

OnError set a callback function to execute everytime an error happens when sending a log to mattermost.

Jump to

Keyboard shortcuts

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