2022-07-12 15:17:29 +08:00
|
|
|
package log
|
|
|
|
|
|
|
|
import (
|
2023-03-13 11:23:00 +08:00
|
|
|
"github.com/sagernet/sing/common/logger"
|
2022-07-12 15:17:29 +08:00
|
|
|
"github.com/sagernet/sing/common/observable"
|
|
|
|
)
|
|
|
|
|
2023-03-13 11:23:00 +08:00
|
|
|
type (
|
|
|
|
Logger logger.Logger
|
|
|
|
ContextLogger logger.ContextLogger
|
|
|
|
)
|
|
|
|
|
2022-07-12 15:17:29 +08:00
|
|
|
type Factory interface {
|
2023-12-04 11:47:25 +08:00
|
|
|
Start() error
|
|
|
|
Close() error
|
2022-07-12 15:17:29 +08:00
|
|
|
Level() Level
|
|
|
|
SetLevel(level Level)
|
|
|
|
Logger() ContextLogger
|
|
|
|
NewLogger(tag string) ContextLogger
|
|
|
|
}
|
|
|
|
|
|
|
|
type ObservableFactory interface {
|
|
|
|
Factory
|
|
|
|
observable.Observable[Entry]
|
|
|
|
}
|
|
|
|
|
|
|
|
type Entry struct {
|
|
|
|
Level Level
|
|
|
|
Message string
|
|
|
|
}
|