sing-box/log/log.go

31 lines
609 B
Go
Raw Normal View History

2022-06-30 13:27:56 +00:00
package log
import (
"context"
2022-07-02 06:07:50 +00:00
"github.com/sagernet/sing-box/option"
2022-06-30 13:27:56 +00:00
)
type Logger interface {
2022-07-02 17:57:04 +00:00
Start() error
Close() error
2022-07-02 06:07:50 +00:00
Trace(args ...interface{})
Debug(args ...interface{})
Info(args ...interface{})
Print(args ...interface{})
Warn(args ...interface{})
Warning(args ...interface{})
Error(args ...interface{})
Fatal(args ...interface{})
Panic(args ...interface{})
WithContext(ctx context.Context) Logger
WithPrefix(prefix string) Logger
}
func NewLogger(options option.LogOption) (Logger, error) {
if options.Disabled {
return NewNopLogger(), nil
}
return NewLogrusLogger(options)
2022-06-30 13:27:56 +00:00
}