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"
|
|
|
|
"v2ray.com/core/common/serial"
|
2016-05-12 02:24:41 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
type LogEntry interface {
|
|
|
|
common.Releasable
|
2016-05-24 15:55:46 -04:00
|
|
|
fmt.Stringer
|
2016-05-12 02:24:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
type ErrorLog struct {
|
|
|
|
Prefix string
|
|
|
|
Values []interface{}
|
|
|
|
}
|
|
|
|
|
2016-11-27 15:39:09 -05:00
|
|
|
func (v *ErrorLog) Release() {
|
|
|
|
for index := range v.Values {
|
|
|
|
v.Values[index] = nil
|
2016-05-12 02:24:41 -04:00
|
|
|
}
|
2016-11-27 15:39:09 -05:00
|
|
|
v.Values = nil
|
2016-05-12 02:24:41 -04:00
|
|
|
}
|
|
|
|
|
2016-11-27 15:39:09 -05:00
|
|
|
func (v *ErrorLog) String() string {
|
2016-12-04 03:10:47 -05:00
|
|
|
return v.Prefix + serial.Concat(v.Values...)
|
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
|
|
|
}
|
|
|
|
|
2016-11-27 15:39:09 -05:00
|
|
|
func (v *AccessLog) Release() {
|
|
|
|
v.From = nil
|
|
|
|
v.To = nil
|
|
|
|
v.Reason = nil
|
2016-05-12 02:24:41 -04:00
|
|
|
}
|
|
|
|
|
2016-11-27 15:39:09 -05:00
|
|
|
func (v *AccessLog) String() string {
|
2016-12-04 03:10:47 -05:00
|
|
|
return strings.Join([]string{serial.ToString(v.From), v.Status, serial.ToString(v.To), serial.ToString(v.Reason)}, " ")
|
2016-05-12 02:24:41 -04:00
|
|
|
}
|