added more strategies

This commit is contained in:
u80864958
2025-05-09 18:32:06 +02:00
parent 2283c0f9b8
commit 4e2b95f945
8 changed files with 135 additions and 38 deletions

View File

@ -1,3 +1,4 @@
// logger is a async logger
package logger
import (
@ -18,21 +19,18 @@ type Logger struct {
}
func New(l lvl.Level) *Logger {
c := make(chan *Log, 20)
go func() {
for log := range c {
fmt.Printf("%v: %s\n", log.Level, log.Message)
}
}()
return &Logger{
Level: l,
LogChan: c,
}
}
func NewWithStrategy(lvl lvl.Level, log func(<-chan *Log)) *Logger {
@ -44,5 +42,4 @@ func NewWithStrategy(lvl lvl.Level, log func(<-chan *Log)) *Logger {
Level: lvl,
LogChan: c,
}
}