summaryrefslogtreecommitdiffstats
path: root/modules/log/console.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2016-11-26 19:53:29 +0800
committerLunny Xiao <xiaolunwen@gmail.com>2016-11-26 19:53:29 +0800
commit3228544c31943ee11957d204fc6904e112be8fcb (patch)
treec91a1bde9ab16017705e45ef5bf459d8821eaa37 /modules/log/console.go
parent0a76d260fa16764ab66bf1623b4cd9e9adfdac27 (diff)
downloadgitea-3228544c31943ee11957d204fc6904e112be8fcb.tar.gz
gitea-3228544c31943ee11957d204fc6904e112be8fcb.zip
golint fixed for modules/log
Diffstat (limited to 'modules/log/console.go')
-rw-r--r--modules/log/console.go15
1 files changed, 11 insertions, 4 deletions
diff --git a/modules/log/console.go b/modules/log/console.go
index f5a8b96fd7..04991243fc 100644
--- a/modules/log/console.go
+++ b/modules/log/console.go
@@ -11,8 +11,10 @@ import (
"runtime"
)
+// Brush brush type
type Brush func(string) string
+// NewBrush create a brush according color
func NewBrush(color string) Brush {
pre := "\033["
reset := "\033[0m"
@@ -37,7 +39,7 @@ type ConsoleWriter struct {
Level int `json:"level"`
}
-// create ConsoleWriter returning as LoggerInterface.
+// NewConsole create ConsoleWriter returning as LoggerInterface.
func NewConsole() LoggerInterface {
return &ConsoleWriter{
lg: log.New(os.Stdout, "", log.Ldate|log.Ltime),
@@ -45,10 +47,14 @@ func NewConsole() LoggerInterface {
}
}
+// Init inits connection writer with json config.
+// json config only need key "level".
func (cw *ConsoleWriter) Init(config string) error {
return json.Unmarshal([]byte(config), cw)
}
+// WriteMsg writes message in console.
+// if OS is windows, ignore colors.
func (cw *ConsoleWriter) WriteMsg(msg string, skip, level int) error {
if cw.Level > level {
return nil
@@ -61,11 +67,12 @@ func (cw *ConsoleWriter) WriteMsg(msg string, skip, level int) error {
return nil
}
-func (_ *ConsoleWriter) Flush() {
-
+// Flush when log should be flushed
+func (cw *ConsoleWriter) Flush() {
}
-func (_ *ConsoleWriter) Destroy() {
+// Destroy when writer is destroy
+func (cw *ConsoleWriter) Destroy() {
}
func init() {