v2ray-core/app/log/internal/log_entry.go

33 lines
517 B
Go
Raw Normal View History

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
}
2016-11-27 20:39:09 +00:00
func (v *ErrorLog) String() string {
2017-04-10 13:03:10 +00:00
return v.Prefix + v.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
}
2016-11-27 20:39:09 +00:00
func (v *AccessLog) String() string {
2016-12-04 08:10:47 +00:00
return strings.Join([]string{serial.ToString(v.From), v.Status, serial.ToString(v.To), serial.ToString(v.Reason)}, " ")
2016-05-12 06:24:41 +00:00
}