github.com/inazumav/sing-box@v0.0.0-20230926072359-ab51429a14f1/log/nop.go (about) 1 package log 2 3 import ( 4 "context" 5 "os" 6 7 "github.com/sagernet/sing/common/observable" 8 ) 9 10 var _ ObservableFactory = (*nopFactory)(nil) 11 12 type nopFactory struct{} 13 14 func NewNOPFactory() ObservableFactory { 15 return (*nopFactory)(nil) 16 } 17 18 func (f *nopFactory) Level() Level { 19 return LevelTrace 20 } 21 22 func (f *nopFactory) SetLevel(level Level) { 23 } 24 25 func (f *nopFactory) Logger() ContextLogger { 26 return f 27 } 28 29 func (f *nopFactory) NewLogger(tag string) ContextLogger { 30 return f 31 } 32 33 func (f *nopFactory) Trace(args ...any) { 34 } 35 36 func (f *nopFactory) Debug(args ...any) { 37 } 38 39 func (f *nopFactory) Info(args ...any) { 40 } 41 42 func (f *nopFactory) Warn(args ...any) { 43 } 44 45 func (f *nopFactory) Error(args ...any) { 46 } 47 48 func (f *nopFactory) Fatal(args ...any) { 49 } 50 51 func (f *nopFactory) Panic(args ...any) { 52 } 53 54 func (f *nopFactory) TraceContext(ctx context.Context, args ...any) { 55 } 56 57 func (f *nopFactory) DebugContext(ctx context.Context, args ...any) { 58 } 59 60 func (f *nopFactory) InfoContext(ctx context.Context, args ...any) { 61 } 62 63 func (f *nopFactory) WarnContext(ctx context.Context, args ...any) { 64 } 65 66 func (f *nopFactory) ErrorContext(ctx context.Context, args ...any) { 67 } 68 69 func (f *nopFactory) FatalContext(ctx context.Context, args ...any) { 70 } 71 72 func (f *nopFactory) PanicContext(ctx context.Context, args ...any) { 73 } 74 75 func (f *nopFactory) Close() error { 76 return nil 77 } 78 79 func (f *nopFactory) Subscribe() (subscription observable.Subscription[Entry], done <-chan struct{}, err error) { 80 return nil, nil, os.ErrInvalid 81 } 82 83 func (f *nopFactory) UnSubscribe(subscription observable.Subscription[Entry]) { 84 }