This commit is contained in:
V2Ray 2015-11-28 20:11:23 +01:00
parent 7720d6bff6
commit 6626c22a8d
2 changed files with 9 additions and 9 deletions

View File

@ -22,7 +22,7 @@ type accessLogger interface {
type noOpAccessLogger struct {
}
func (logger *noOpAccessLogger) Log(from, to string, status AccessStatus, reason string) {
func (this *noOpAccessLogger) Log(from, to string, status AccessStatus, reason string) {
// Swallow
}
@ -39,8 +39,8 @@ type fileAccessLogger struct {
file *os.File
}
func (logger *fileAccessLogger) close() {
logger.file.Close()
func (this *fileAccessLogger) close() {
this.file.Close()
}
func (logger *fileAccessLogger) Log(from, to string, status AccessStatus, reason string) {
@ -56,9 +56,9 @@ func (logger *fileAccessLogger) Log(from, to string, status AccessStatus, reason
}
}
func (logger *fileAccessLogger) Run() {
for entry := range logger.queue {
logger.logger.Println(entry.From + " " + string(entry.Status) + " " + entry.To + " " + entry.Reason)
func (this *fileAccessLogger) Run() {
for entry := range this.queue {
this.logger.Println(entry.From + " " + string(entry.Status) + " " + entry.To + " " + entry.Reason)
}
}

View File

@ -22,7 +22,7 @@ type logger interface {
type noOpLogger struct {
}
func (l *noOpLogger) WriteLog(prefix, format string, v ...interface{}) {
func (this *noOpLogger) WriteLog(prefix, format string, v ...interface{}) {
// Swallow
}
@ -30,14 +30,14 @@ type streamLogger struct {
writer io.Writer
}
func (l *streamLogger) WriteLog(prefix, format string, v ...interface{}) {
func (this *streamLogger) WriteLog(prefix, format string, v ...interface{}) {
var data string
if v == nil || len(v) == 0 {
data = format
} else {
data = fmt.Sprintf(format, v...)
}
l.writer.Write([]byte(prefix + data + platform.LineSeparator()))
this.writer.Write([]byte(prefix + data + platform.LineSeparator()))
}
var (