io

package
v1.3.11 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2021 License: MPL-2.0 Imports: 5 Imported by: 4

Documentation

Index

Constants

View Source
const (
	SeverityError   = "ERROR"
	SeverityInfo    = "INFO"
	SeverityWarning = "WARNING"
)

Variables

This section is empty.

Functions

func CloseResourceSecure added in v1.3.10

func CloseResourceSecure(name string, c io.Closer)

CloseResourceSecure allows to call closer and handle errors as warnings in logs

func CutMessageIfNeeded

func CutMessageIfNeeded(message string) string

func GenerateMessage

func GenerateMessage(eventType, message, topic string) string

func OutputError

func OutputError(err error, topic, msg string, args ...interface{})

OutputError shows error as [ERROR] {error_message}, {message} [{topic}] e.g. [ERROR] Cannot write file "tt.txt", please check permissions 664 on folder /tmp/tt.txt [order_123] topic is needed to group logged event for certain process e.g. all events which happened to order_123 we also cut line separators because normally such messages are split by them as separate messages we also cut too long messages (more than maxMessageLength chars) because of the processing overhead for long outputs

func OutputInfo

func OutputInfo(topic, msg string, args ...interface{})

OutputWarning shows warning as [INFO] {message} [{topic}] e.g. [INFO] Cannot send email [order_123]

func OutputMessageType

func OutputMessageType(messageType, topic, msg string, args ...interface{})

OutputMessageType shows a message as [{messageType}] {message} [{topic}]

func OutputSingleLine

func OutputSingleLine(message string, args ...interface{})

OutputSingleLine is deprecated should be used in internal outputs

func OutputSingleLineWithTopic

func OutputSingleLineWithTopic(topic, message string, args ...interface{})

OutputSingleLineWithTopic is deprecated should be used in internal outputs

func OutputWarning

func OutputWarning(topic, msg string, args ...interface{})

OutputWarning shows warning as [WARNING] {message} [{topic}] e.g. [WARNING] Cannot send email [order_123]

func RemoveLineBreaks

func RemoveLineBreaks(input string) string

func SetLogger added in v1.3.7

func SetLogger(l Logger)

func SetMaxMessageLength

func SetMaxMessageLength(newValue int)

Types

type DefaultLogger added in v1.3.7

type DefaultLogger struct{}

func (DefaultLogger) OutputMessageType added in v1.3.7

func (dl DefaultLogger) OutputMessageType(messageType, topic, msg string, args ...interface{})

type Logger added in v1.3.7

type Logger interface {
	OutputMessageType(messageType, topic, msg string, args ...interface{})
}

Jump to

Keyboard shortcuts

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