log_entry.go 517 B

1234567891011121314151617181920212223242526272829303132
  1. package internal
  2. import (
  3. "fmt"
  4. "strings"
  5. "v2ray.com/core/common/serial"
  6. )
  7. type LogEntry interface {
  8. fmt.Stringer
  9. }
  10. type ErrorLog struct {
  11. Prefix string
  12. Error error
  13. }
  14. func (l *ErrorLog) String() string {
  15. return l.Prefix + l.Error.Error()
  16. }
  17. type AccessLog struct {
  18. From interface{}
  19. To interface{}
  20. Status string
  21. Reason interface{}
  22. }
  23. func (l *AccessLog) String() string {
  24. return strings.Join([]string{serial.ToString(l.From), l.Status, serial.ToString(l.To), serial.ToString(l.Reason)}, " ")
  25. }