github.com/sagernet/sing-box@v1.9.0-rc.20/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) Start() error { 19 return nil 20 } 21 22 func (f *nopFactory) Close() error { 23 return nil 24 } 25 26 func (f *nopFactory) Level() Level { 27 return LevelTrace 28 } 29 30 func (f *nopFactory) SetLevel(level Level) { 31 } 32 33 func (f *nopFactory) Logger() ContextLogger { 34 return f 35 } 36 37 func (f *nopFactory) NewLogger(tag string) ContextLogger { 38 return f 39 } 40 41 func (f *nopFactory) Trace(args ...any) { 42 } 43 44 func (f *nopFactory) Debug(args ...any) { 45 } 46 47 func (f *nopFactory) Info(args ...any) { 48 } 49 50 func (f *nopFactory) Warn(args ...any) { 51 } 52 53 func (f *nopFactory) Error(args ...any) { 54 } 55 56 func (f *nopFactory) Fatal(args ...any) { 57 } 58 59 func (f *nopFactory) Panic(args ...any) { 60 } 61 62 func (f *nopFactory) TraceContext(ctx context.Context, args ...any) { 63 } 64 65 func (f *nopFactory) DebugContext(ctx context.Context, args ...any) { 66 } 67 68 func (f *nopFactory) InfoContext(ctx context.Context, args ...any) { 69 } 70 71 func (f *nopFactory) WarnContext(ctx context.Context, args ...any) { 72 } 73 74 func (f *nopFactory) ErrorContext(ctx context.Context, args ...any) { 75 } 76 77 func (f *nopFactory) FatalContext(ctx context.Context, args ...any) { 78 } 79 80 func (f *nopFactory) PanicContext(ctx context.Context, args ...any) { 81 } 82 83 func (f *nopFactory) Subscribe() (subscription observable.Subscription[Entry], done <-chan struct{}, err error) { 84 return nil, nil, os.ErrInvalid 85 } 86 87 func (f *nopFactory) UnSubscribe(subscription observable.Subscription[Entry]) { 88 }