types

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: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConnectionTCP   = "tcp"
	ConnectionUDP   = "udp"
	ConnectionLOCAL = "local"
	ConnectionFILE  = "file"
	ConnectionNSQ   = "nsq"
)
View Source
const (
	TagStartUp  = "startup"
	TagConnect  = "connect"
	TagRoutine  = "routine"
	TagShutDown = "shutdown"
)
View Source
const (
	DelimiterV       = " | "
	DelimiterH       = " - "
	DelimiterA       = " * "
	DefaultDelimiter = DelimiterV
)
View Source
const (
	LogCallerSkipLevels = 4
)
View Source
const MaxConnectorQ = 5 // TODO make configurable
View Source
const (
	SyncFileAfterMessagesCount = 100
)

Variables

View Source
var DefaultReconnectionTime = time.Minute // TODO make configurable
View Source
var LogLevels = map[LogLevel]string{
	EMERG:  "EMERGENCY",
	ALERT:  "ALERT",
	CRIT:   "CRITICAL",
	ERR:    "ERROR",
	WARN:   "WARNING",
	NOTIFY: "NOTIFICATION",
	INFO:   "INFO",
	DEBUG:  "DEBUG",
}
View Source
var LogLevelsInv = map[string]LogLevel{
	"EMERGENCY":    EMERG,
	"ALERT":        ALERT,
	"CRITICAL":     CRIT,
	"ERROR":        ERR,
	"WARNING":      WARN,
	"NOTIFICATION": NOTIFY,
	"INFO":         INFO,
	"DEBUG":        DEBUG,
}

Functions

This section is empty.

Types

type LogLevel

type LogLevel int
const (
	EMERG LogLevel = iota
	ALERT
	CRIT
	ERR
	WARN
	NOTIFY
	INFO
	DEBUG
	FORCE // force one of levels above
)

type LogParams

type LogParams struct {
	IsForced     bool
	Level        LogLevel
	IsWithCaller bool
}

LogParams contains log level parameters

type LogWriter

type LogWriter interface {
	Write([]byte) (int, error)
	WriteForced(LogLevel, []byte) (int, error)
	Close() error
}

LogWriter is an interface that must be implemented for using with logger

type MsgParams

type MsgParams struct {
	Delimiter string
	Tag       string
	Msg       string
}

MsgParams contains parameters of message to be logged

type TimeParams

type TimeParams struct {
	Location *time.Location
	Format   string
}

TimeParams contains information about location and time format for logging

type WriterStatus

type WriterStatus uint8
const (
	WriterStatusUndefined WriterStatus = iota
	WriterStatusOk
	WriterStatusStopped
)

Jump to

Keyboard shortcuts

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