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 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
|
|
|
|
Close() error
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewLogger(options option.LogOption) (Logger, error) {
|
|
|
|
if options.Disabled {
|
|
|
|
return NewNopLogger(), nil
|
|
|
|
}
|
|
|
|
return NewLogrusLogger(options)
|
2022-06-30 13:27:56 +00:00
|
|
|
}
|