2023-04-23 11:31:41 +00:00
|
|
|
package singbridge
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/sagernet/sing/common/logger"
|
|
|
|
"github.com/xtls/xray-core/common/errors"
|
|
|
|
)
|
|
|
|
|
|
|
|
var _ logger.ContextLogger = (*XrayLogger)(nil)
|
|
|
|
|
|
|
|
type XrayLogger struct {
|
|
|
|
newError func(values ...any) *errors.Error
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewLogger(newErrorFunc func(values ...any) *errors.Error) *XrayLogger {
|
|
|
|
return &XrayLogger{
|
|
|
|
newErrorFunc,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (l *XrayLogger) Trace(args ...any) {
|
|
|
|
}
|
|
|
|
|
|
|
|
func (l *XrayLogger) Debug(args ...any) {
|
2024-06-29 18:32:57 +00:00
|
|
|
errors.LogDebug(context.Background(), args...)
|
2023-04-23 11:31:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (l *XrayLogger) Info(args ...any) {
|
2024-06-29 18:32:57 +00:00
|
|
|
errors.LogInfo(context.Background(), args...)
|
2023-04-23 11:31:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (l *XrayLogger) Warn(args ...any) {
|
2024-06-29 18:32:57 +00:00
|
|
|
errors.LogWarning(context.Background(), args...)
|
2023-04-23 11:31:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (l *XrayLogger) Error(args ...any) {
|
2024-06-29 18:32:57 +00:00
|
|
|
errors.LogError(context.Background(), args...)
|
2023-04-23 11:31:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (l *XrayLogger) Fatal(args ...any) {
|
|
|
|
}
|
|
|
|
|
|
|
|
func (l *XrayLogger) Panic(args ...any) {
|
|
|
|
}
|
|
|
|
|
|
|
|
func (l *XrayLogger) TraceContext(ctx context.Context, args ...any) {
|
|
|
|
}
|
|
|
|
|
|
|
|
func (l *XrayLogger) DebugContext(ctx context.Context, args ...any) {
|
2024-06-29 18:32:57 +00:00
|
|
|
errors.LogDebug(ctx, args...)
|
2023-04-23 11:31:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (l *XrayLogger) InfoContext(ctx context.Context, args ...any) {
|
2024-06-29 18:32:57 +00:00
|
|
|
errors.LogInfo(ctx, args...)
|
2023-04-23 11:31:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (l *XrayLogger) WarnContext(ctx context.Context, args ...any) {
|
2024-06-29 18:32:57 +00:00
|
|
|
errors.LogWarning(ctx, args...)
|
2023-04-23 11:31:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (l *XrayLogger) ErrorContext(ctx context.Context, args ...any) {
|
2024-06-29 18:32:57 +00:00
|
|
|
errors.LogError(ctx, args...)
|
2023-04-23 11:31:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (l *XrayLogger) FatalContext(ctx context.Context, args ...any) {
|
|
|
|
}
|
|
|
|
|
|
|
|
func (l *XrayLogger) PanicContext(ctx context.Context, args ...any) {
|
|
|
|
}
|