comments and code refactoring

This commit is contained in:
2024-04-24 11:52:14 +02:00
parent 01c327d308
commit 00bacf5c41
7 changed files with 39 additions and 20 deletions

View File

@@ -8,6 +8,15 @@ import (
"time"
)
/*
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
*/
// implements io.Writer interface
type LogRotateWriter struct {
mu sync.Mutex

View File

@@ -6,6 +6,17 @@ import (
"github.com/reactivex/rxgo/v2"
)
/*
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
*/
var (
logsChan = make(chan rxgo.Item, 100)
logsObservable = rxgo.