logger

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RedisLoggerQueue  = "core.logs"
	MaxRedisQueueSize = 100000
)

Variables

View Source
var (
	Disabled = []int{stream.LevelInvalid}
)

Functions

func IsLoggable

func IsLoggable(defaults []int, cmd *core.Command, msg *stream.Message) bool

Types

type ConsoleLogger

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

ConsoleLogger log message to the console

func (*ConsoleLogger) Log

func (logger *ConsoleLogger) Log(cmd *core.Command, msg *stream.Message)

Log messages

func (*ConsoleLogger) LogRecord

func (logger *ConsoleLogger) LogRecord(record *LogRecord)

type DBLogger

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

DBLogger implements a logger that stores the message in a bold database.

func (*DBLogger) Log

func (logger *DBLogger) Log(cmd *core.Command, msg *stream.Message)

func (*DBLogger) LogRecord

func (logger *DBLogger) LogRecord(record *LogRecord)

Log message

type LogRecord

type LogRecord struct {
	Core    uint16          `json:"core"`
	Command string          `json:"command"`
	Message *stream.Message `json:"message"`
}

type Logger

type Logger interface {
	Log(*core.Command, *stream.Message)
	LogRecord(record *LogRecord)
}

Logger interface

func NewConsoleLogger

func NewConsoleLogger(coreID uint16, defaults []int) Logger

NewConsoleLogger creates a simple console logger that prints log messages to Console.

func NewDBLogger

func NewDBLogger(coreID uint16, db *bolt.DB, defaults []int) (Logger, error)

NewDBLogger creates a new Database logger, it stores the logged message in database factory: is the DB connection factory defaults: default log levels to store in db if is not specificed by the logged message.

func NewRedisLogger

func NewRedisLogger(coreID uint16, address string, password string, defaults []int, batchSize int) Logger

NewRedisLogger creates new redis logger handler

Jump to

Keyboard shortcuts

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