2022-07-02 06:07:50 +00:00
|
|
|
package log
|
|
|
|
|
2022-07-20 01:41:44 +00:00
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"os"
|
2022-07-02 06:07:50 +00:00
|
|
|
|
2022-07-20 01:41:44 +00:00
|
|
|
"github.com/sagernet/sing/common/observable"
|
|
|
|
)
|
|
|
|
|
|
|
|
var _ ObservableFactory = (*nopFactory)(nil)
|
2022-07-02 06:07:50 +00:00
|
|
|
|
2022-07-12 07:17:29 +00:00
|
|
|
type nopFactory struct{}
|
2022-07-02 06:07:50 +00:00
|
|
|
|
2022-07-20 01:41:44 +00:00
|
|
|
func NewNOPFactory() ObservableFactory {
|
2022-07-12 07:17:29 +00:00
|
|
|
return (*nopFactory)(nil)
|
2022-07-02 06:07:50 +00:00
|
|
|
}
|
|
|
|
|
2023-12-04 03:47:25 +00:00
|
|
|
func (f *nopFactory) Start() error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (f *nopFactory) Close() error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2022-07-12 07:17:29 +00:00
|
|
|
func (f *nopFactory) Level() Level {
|
|
|
|
return LevelTrace
|
2022-07-02 17:57:04 +00:00
|
|
|
}
|
|
|
|
|
2022-07-12 07:17:29 +00:00
|
|
|
func (f *nopFactory) SetLevel(level Level) {
|
2022-07-02 17:57:04 +00:00
|
|
|
}
|
|
|
|
|
2022-07-12 07:17:29 +00:00
|
|
|
func (f *nopFactory) Logger() ContextLogger {
|
|
|
|
return f
|
2022-07-02 06:07:50 +00:00
|
|
|
}
|
|
|
|
|
2022-07-12 07:17:29 +00:00
|
|
|
func (f *nopFactory) NewLogger(tag string) ContextLogger {
|
|
|
|
return f
|
2022-07-02 06:07:50 +00:00
|
|
|
}
|
|
|
|
|
2022-07-12 07:17:29 +00:00
|
|
|
func (f *nopFactory) Trace(args ...any) {
|
2022-07-02 06:07:50 +00:00
|
|
|
}
|
|
|
|
|
2022-07-12 07:17:29 +00:00
|
|
|
func (f *nopFactory) Debug(args ...any) {
|
2022-07-02 06:07:50 +00:00
|
|
|
}
|
|
|
|
|
2022-07-12 07:17:29 +00:00
|
|
|
func (f *nopFactory) Info(args ...any) {
|
2022-07-02 06:07:50 +00:00
|
|
|
}
|
|
|
|
|
2022-07-12 07:17:29 +00:00
|
|
|
func (f *nopFactory) Warn(args ...any) {
|
2022-07-02 06:07:50 +00:00
|
|
|
}
|
|
|
|
|
2022-07-12 07:17:29 +00:00
|
|
|
func (f *nopFactory) Error(args ...any) {
|
2022-07-02 06:07:50 +00:00
|
|
|
}
|
|
|
|
|
2022-07-12 07:17:29 +00:00
|
|
|
func (f *nopFactory) Fatal(args ...any) {
|
2022-07-02 06:07:50 +00:00
|
|
|
}
|
|
|
|
|
2022-07-12 07:17:29 +00:00
|
|
|
func (f *nopFactory) Panic(args ...any) {
|
2022-07-02 06:07:50 +00:00
|
|
|
}
|
|
|
|
|
2022-07-12 07:17:29 +00:00
|
|
|
func (f *nopFactory) TraceContext(ctx context.Context, args ...any) {
|
2022-07-02 06:07:50 +00:00
|
|
|
}
|
|
|
|
|
2022-07-12 07:17:29 +00:00
|
|
|
func (f *nopFactory) DebugContext(ctx context.Context, args ...any) {
|
|
|
|
}
|
|
|
|
|
|
|
|
func (f *nopFactory) InfoContext(ctx context.Context, args ...any) {
|
|
|
|
}
|
|
|
|
|
|
|
|
func (f *nopFactory) WarnContext(ctx context.Context, args ...any) {
|
|
|
|
}
|
|
|
|
|
|
|
|
func (f *nopFactory) ErrorContext(ctx context.Context, args ...any) {
|
|
|
|
}
|
|
|
|
|
|
|
|
func (f *nopFactory) FatalContext(ctx context.Context, args ...any) {
|
|
|
|
}
|
|
|
|
|
|
|
|
func (f *nopFactory) PanicContext(ctx context.Context, args ...any) {
|
2022-07-02 06:07:50 +00:00
|
|
|
}
|
2022-07-20 01:41:44 +00:00
|
|
|
|
|
|
|
func (f *nopFactory) Subscribe() (subscription observable.Subscription[Entry], done <-chan struct{}, err error) {
|
|
|
|
return nil, nil, os.ErrInvalid
|
|
|
|
}
|
|
|
|
|
|
|
|
func (f *nopFactory) UnSubscribe(subscription observable.Subscription[Entry]) {
|
|
|
|
}
|