2016-05-12 06:24:41 +00:00
|
|
|
package internal
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2016-07-15 19:15:41 +00:00
|
|
|
"strings"
|
2016-05-12 06:24:41 +00:00
|
|
|
|
2016-08-20 18:55:45 +00:00
|
|
|
"v2ray.com/core/common/serial"
|
2016-05-12 06:24:41 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type LogEntry interface {
|
2016-05-24 19:55:46 +00:00
|
|
|
fmt.Stringer
|
2016-05-12 06:24:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type ErrorLog struct {
|
|
|
|
Prefix string
|
2017-04-10 13:03:10 +00:00
|
|
|
Error error
|
2016-05-12 06:24:41 +00:00
|
|
|
}
|
|
|
|
|
2017-04-23 17:16:56 +00:00
|
|
|
func (l *ErrorLog) String() string {
|
|
|
|
return l.Prefix + l.Error.Error()
|
2016-05-12 06:24:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type AccessLog struct {
|
2016-05-24 20:41:51 +00:00
|
|
|
From interface{}
|
|
|
|
To interface{}
|
2016-05-12 06:24:41 +00:00
|
|
|
Status string
|
2016-05-24 20:41:51 +00:00
|
|
|
Reason interface{}
|
2016-05-12 06:24:41 +00:00
|
|
|
}
|
|
|
|
|
2017-04-23 17:16:56 +00: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 06:24:41 +00:00
|
|
|
}
|