From 6626c22a8d19b639c48e20a7efc029c655cd9625 Mon Sep 17 00:00:00 2001 From: V2Ray Date: Sat, 28 Nov 2015 20:11:23 +0100 Subject: [PATCH] refactor --- common/log/access.go | 12 ++++++------ common/log/log.go | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/common/log/access.go b/common/log/access.go index 10e439608..a92c70de4 100644 --- a/common/log/access.go +++ b/common/log/access.go @@ -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) } } diff --git a/common/log/log.go b/common/log/log.go index 786509e65..5391d76a2 100644 --- a/common/log/log.go +++ b/common/log/log.go @@ -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 (