msglogger

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeVoidLogger = "void_logger"
	TypeFileLogger = "file_logger"
)

logger types

Variables

This section is empty.

Functions

This section is empty.

Types

type FileMessageLogger

type FileMessageLogger struct {
	GatewayID        string                                // Gateway id
	MsgFormatterFunc func(rawMsg *msgTY.RawMessage) string // should supply a func to return parsed message

	Config fileMessageLoggerConfig // self configurations
	// contains filtered or unexported fields
}

FileMessageLogger struct

func NewFileMessageLogger

func NewFileMessageLogger(logger *zap.Logger, gatewayID string, config cmap.CustomMap, formatterFunc func(rawMsg *msgTY.RawMessage) string, logRootDir string) (*FileMessageLogger, error)

NewFileMessageLogger file logger

func (*FileMessageLogger) AsyncWrite

func (rml *FileMessageLogger) AsyncWrite(rawMsg *msgTY.RawMessage)

AsyncWrite func adds the message into the queue and returns immediately

func (*FileMessageLogger) Close

func (rml *FileMessageLogger) Close()

Close terminates the async runner

func (*FileMessageLogger) Start

func (rml *FileMessageLogger) Start()

Start func inits the the queue and channel and starts the async runner

type MessageLogger

type MessageLogger interface {
	Start()                              // Start the message logger
	Close()                              // Stop and close the message logger
	AsyncWrite(rawMsg *msgTY.RawMessage) // write a message
}

MessageLogger interface

func GetNoopLogger

func GetNoopLogger() MessageLogger

GetNoopLogger can be used for pre stage

func New

func New(logger *zap.Logger, gatewayID string, config cmap.CustomMap, formatterFunc func(rawMsg *msgTY.RawMessage) string, logRootDir string) MessageLogger

New message logger

type NoopMessageLogger

type NoopMessageLogger struct {
}

No Operation message logger struct

func (*NoopMessageLogger) AsyncWrite

func (vm *NoopMessageLogger) AsyncWrite(rawMsg *msgTY.RawMessage)

AsyncWrite implementation

func (*NoopMessageLogger) Close

func (vm *NoopMessageLogger) Close()

Close implementation

func (*NoopMessageLogger) Start

func (vm *NoopMessageLogger) Start()

Start implementation

Jump to

Keyboard shortcuts

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