2016-05-12 02:24:41 -04:00
|
|
|
package internal
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2016-07-15 15:15:41 -04:00
|
|
|
"strings"
|
2016-05-12 02:24:41 -04:00
|
|
|
|
2016-08-20 14:55:45 -04:00
|
|
|
"v2ray.com/core/common/serial"
|
2016-05-12 02:24:41 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
type LogEntry interface {
|
2016-05-24 15:55:46 -04:00
|
|
|
fmt.Stringer
|
2016-05-12 02:24:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
type ErrorLog struct {
|
|
|
|
Prefix string
|
2017-04-10 09:03:10 -04:00
|
|
|
Error error
|
2016-05-12 02:24:41 -04:00
|
|
|
}
|
|
|
|
|
2017-04-23 13:16:56 -04:00
|
|
|
func (l *ErrorLog) String() string {
|
|
|
|
return l.Prefix + l.Error.Error()
|
2016-05-12 02:24:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
type AccessLog struct {
|
2016-05-24 16:41:51 -04:00
|
|
|
From interface{}
|
|
|
|
To interface{}
|
2016-05-12 02:24:41 -04:00
|
|
|
Status string
|
2016-05-24 16:41:51 -04:00
|
|
|
Reason interface{}
|
2016-05-12 02:24:41 -04:00
|
|
|
}
|
|
|
|
|
2017-04-23 13:16:56 -04:00
|
|
|
func (l *AccessLog) String() string {
|
|
|
|
return strings.Join([]string{serial.ToString(l.From), l.Status, serial.ToString(l.To), serial.ToString(l.Reason)}, " ")
|
2016-05-12 02:24:41 -04:00
|
|
|
}
|