diff --git a/utils/log/log.go b/utils/log/log.go index a0e42b8..c0ce7f1 100644 --- a/utils/log/log.go +++ b/utils/log/log.go @@ -20,6 +20,7 @@ import ( "github.com/fatedier/beego/logs" ) +// Log is the under log object var Log *logs.BeeLogger func init() { @@ -33,6 +34,7 @@ func InitLog(logWay string, logFile string, logLevel string, maxdays int64) { SetLogLevel(logLevel) } +// SetLogFile to configure log params // logWay: file or console func SetLogFile(logWay string, logFile string, maxdays int64) { if logWay == "console" { @@ -43,6 +45,7 @@ func SetLogFile(logWay string, logFile string, maxdays int64) { } } +// SetLogLevel set log level, default is warning // value: error, warning, info, debug, trace func SetLogLevel(logLevel string) { level := 4 // warning @@ -85,7 +88,7 @@ func Trace(format string, v ...interface{}) { Log.Trace(format, v...) } -// Logger +// Logger is the log interface type Logger interface { AddLogPrefix(string) GetPrefixStr() string diff --git a/utils/net/websocket.go b/utils/net/websocket.go index 8ecc17e..9942337 100644 --- a/utils/net/websocket.go +++ b/utils/net/websocket.go @@ -31,6 +31,7 @@ type WebsocketListener struct { httpMutex *http.ServeMux } +// NewWebsocketListener to handle websocket connections // ln: tcp listener for websocket connections func NewWebsocketListener(ln net.Listener) (wl *WebsocketListener) { wl = &WebsocketListener{