logging

package
v0.0.0-...-b0dac0a Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyRouter

func ApplyRouter(logger *ObservableLogger) func(chi.Router)

Types

type LogRotateWriter

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

implements io.Writer interface

File base logger with log-rotate capabilities. The rotate process must be initiated from an external goroutine.

After rotation the previous logs file are compressed with gzip algorithm.

The rotated log follows this naming: [filename].UTC time.gz

func NewRotableLogger

func NewRotableLogger(filename string) (*LogRotateWriter, error)

func (*LogRotateWriter) Rotate

func (w *LogRotateWriter) Rotate() error

func (*LogRotateWriter) Write

func (w *LogRotateWriter) Write(b []byte) (int, error)

type ObservableLogger

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

Logger implementation using the observable pattern. Implements io.Writer interface.

The observable is an event source which drops everythigng unless there's a subscriber connected.

The observer implementatios are a http ServerSentEvents handler and a websocket one in handler.go

func NewObservableLogger

func NewObservableLogger() *ObservableLogger

func (*ObservableLogger) Observe

func (o *ObservableLogger) Observe(ctx context.Context) <-chan string

func (*ObservableLogger) Write

func (o *ObservableLogger) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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