pubsub

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogMessage

type LogMessage struct {
	Msg string // The actual log message.
}

LogMessage struct represents a single log entry.

type Logger

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

Logger provides functionality for logging and subscribing to logs.

func NewLogger

func NewLogger() *Logger

NewLogger initializes and returns a new instance of Logger.

func (*Logger) Publish

func (l *Logger) Publish(msg string)

Publish sends a log message to the log channel. It ensures that log writes are thread-safe using a mutex.

func (*Logger) Subscribe

func (l *Logger) Subscribe() <-chan *string

Subscribe provides a read-only channel to receive log messages. This allows external components to "listen" for new logs.

func (*Logger) Write

func (l *Logger) Write(p []byte) (n int, err error)

Write allows the Logger to be used as a Writer and in structured logging.

Jump to

Keyboard shortcuts

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