Merge remote-tracking branch 'clash/dev' into Alpha

# Conflicts:
#	.github/workflows/docker.yml
#	adapter/outboundgroup/fallback.go
#	adapter/outboundgroup/loadbalance.go
#	adapter/outboundgroup/relay.go
#	adapter/outboundgroup/selector.go
#	adapter/outboundgroup/urltest.go
#	config/config.go
#	go.mod
#	go.sum
#	main.go
#	test/go.mod
#	test/go.sum
This commit is contained in:
MetaCubeX
2022-03-17 01:41:51 +08:00
70 changed files with 241 additions and 255 deletions

View File

@@ -25,7 +25,7 @@ const (
type LogLevel int
// UnmarshalYAML unserialize LogLevel with yaml
func (l *LogLevel) UnmarshalYAML(unmarshal func(interface{}) error) error {
func (l *LogLevel) UnmarshalYAML(unmarshal func(any) error) error {
var tp string
unmarshal(&tp)
level, exist := LogLevelMapping[tp]
@@ -54,7 +54,7 @@ func (l LogLevel) MarshalJSON() ([]byte, error) {
}
// MarshalYAML serialize LogLevel with yaml
func (l LogLevel) MarshalYAML() (interface{}, error) {
func (l LogLevel) MarshalYAML() (any, error) {
return l.String(), nil
}

View File

@@ -10,7 +10,7 @@ import (
)
var (
logCh = make(chan interface{})
logCh = make(chan any)
source = observable.NewObservable(logCh)
level = INFO
)
@@ -29,31 +29,31 @@ func (e *Event) Type() string {
return e.LogLevel.String()
}
func Infoln(format string, v ...interface{}) {
func Infoln(format string, v ...any) {
event := newLog(INFO, format, v...)
logCh <- event
print(event)
}
func Warnln(format string, v ...interface{}) {
func Warnln(format string, v ...any) {
event := newLog(WARNING, format, v...)
logCh <- event
print(event)
}
func Errorln(format string, v ...interface{}) {
func Errorln(format string, v ...any) {
event := newLog(ERROR, format, v...)
logCh <- event
print(event)
}
func Debugln(format string, v ...interface{}) {
func Debugln(format string, v ...any) {
event := newLog(DEBUG, format, v...)
logCh <- event
print(event)
}
func Fatalln(format string, v ...interface{}) {
func Fatalln(format string, v ...any) {
log.Fatalf(format, v...)
}
@@ -91,7 +91,7 @@ func print(data *Event) {
}
}
func newLog(logLevel LogLevel, format string, v ...interface{}) *Event {
func newLog(logLevel LogLevel, format string, v ...any) *Event {
return &Event{
LogLevel: logLevel,
Payload: fmt.Sprintf(format, v...),