Add basic clash api

This commit is contained in:
世界 2022-07-19 22:16:49 +08:00
parent c7fabe40ed
commit c5b3e8b042
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
36 changed files with 1498 additions and 41 deletions

View file

@ -66,17 +66,16 @@ func (l *observableLogger) Log(ctx context.Context, level Level, args []any) {
if level > l.level {
return
}
message := l.formatter.Format(ctx, level, l.tag, F.ToString(args...), time.Now()) + "\n"
message, messageSimple := l.formatter.FormatWithSimple(ctx, level, l.tag, F.ToString(args...), time.Now())
if level == LevelPanic {
panic(message)
}
l.writer.Write([]byte(message))
l.writer.Write([]byte{'\n'})
if level == LevelFatal {
os.Exit(1)
}
if l.subscriber != nil {
l.subscriber.Emit(Entry{level, message})
}
l.subscriber.Emit(Entry{level, messageSimple})
}
func (l *observableLogger) Trace(args ...any) {