Documentation
¶
Index ¶
- Constants
- func CloseResourceSecure(name string, c io.Closer)
- func CutMessageIfNeeded(message string) string
- func GenerateMessage(eventType, message, topic string) string
- func OutputError(err error, topic, msg string, args ...interface{})
- func OutputInfo(topic, msg string, args ...interface{})
- func OutputMessageType(messageType, topic, msg string, args ...interface{})
- func OutputSingleLine(message string, args ...interface{})
- func OutputSingleLineWithTopic(topic, message string, args ...interface{})
- func OutputWarning(topic, msg string, args ...interface{})
- func RemoveLineBreaks(input string) string
- func SetLogger(l Logger)
- func SetMaxMessageLength(newValue int)
- type DefaultLogger
- type Logger
Constants ¶
const ( SeverityError = "ERROR" SeverityInfo = "INFO" SeverityWarning = "WARNING" )
Variables ¶
This section is empty.
Functions ¶
func CloseResourceSecure ¶ added in v1.3.10
CloseResourceSecure allows to call closer and handle errors as warnings in logs
func CutMessageIfNeeded ¶
func GenerateMessage ¶
func OutputError ¶
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 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{})