msglogger

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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