writer

package
v0.0.0-...-c1642f7 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format

func Format(level types.LogLevel, delimiter, tag, prefix, msg string, kvs ...string) string

Format creates a message with giver parameters

func LogCaller

func LogCaller(delimiter, msg string) string

LogCaller adds function name and line number before message

func LogTime

func LogTime(loc *time.Location, format, delimiter, msg string) string

LogTime adds timestamp to the beginning of the message

Types

type Writer

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

Writer is a logging unit with constant connection type, address, prefixTag and priority contains ring buffer for unsent messages

func NewWriter

func NewWriter(connection, addr, prefix string, priority syslog.Priority, bufferLen int) (*Writer, error)

NewWriter creates an logging instance with given parameters

func (*Writer) Reconnect

func (w *Writer) Reconnect() error

Reconnect tries to create new logger connection with old parameters; if succeed sends messages from ring buffer and erases them

func (*Writer) Stop

func (w *Writer) Stop()

Stop closes Writer connection and sets it's status to Stopped; uses mutex lock

func (*Writer) Write

func (w *Writer) Write(lp types.LogParams, tp types.TimeParams, mp types.MsgParams, kvs ...string) error

Write writes message with parameters if writer status is OK otherwise adds a message to ring buffer

Jump to

Keyboard shortcuts

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