diff --git a/api/recieve/main.go b/api/recieve/main.go index 0c31182..5327310 100644 --- a/api/recieve/main.go +++ b/api/recieve/main.go @@ -1,5 +1,5 @@ -// reciever of log entry over network (websocket) -package recieve +// receiver of log entry over network (websocket) +package receive import ( "encoding/json" @@ -38,21 +38,21 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { var maybeToken string msgType, msg, err := c.ReadMessage() if err != nil { - logEntry.Error("recieving token", err) + logEntry.Error("receiving token", err) break } if msgType != websocket.TextMessage { - logEntry.Warn("recieve no token") + logEntry.Warn("receive no token") break } maybeToken = string(msg) logEntry.AddField("token", maybeToken) if !database.IsTokenValid(maybeToken) { - logEntry.Warn("recieve wrong token") + logEntry.Warn("receive wrong token") break } else { token = maybeToken - logEntry.Info("recieve valid token") + logEntry.Info("receive valid token") } continue } @@ -64,7 +64,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { break } if err != nil { - logEntry.Error("recieving log entry:", err) + logEntry.Error("receiving log entry:", err) break } err = json.Unmarshal(msg, &entry) diff --git a/api/recieve/main_test.go b/api/recieve/main_test.go index 77c89d3..3ccae50 100644 --- a/api/recieve/main_test.go +++ b/api/recieve/main_test.go @@ -1 +1 @@ -package recieve +package receive diff --git a/cmd/logmania/main.go b/cmd/logmania/main.go index 1b28796..2abaf68 100644 --- a/cmd/logmania/main.go +++ b/cmd/logmania/main.go @@ -15,7 +15,7 @@ import ( "os/signal" "syscall" - "github.com/genofire/logmania/api/recieve" + "github.com/genofire/logmania/api/receive" "github.com/genofire/logmania/database" "github.com/genofire/logmania/lib" "github.com/genofire/logmania/log" @@ -53,7 +53,7 @@ func main() { api = &lib.HTTPServer{ Addr: config.API.Bind, - Handler: recieve.NewHandler(), + Handler: receive.NewHandler(), } api.Start() diff --git a/cmd/logmania/selflog.go b/cmd/logmania/selflog.go index 36f09b7..8a35ca9 100644 --- a/cmd/logmania/selflog.go +++ b/cmd/logmania/selflog.go @@ -8,8 +8,8 @@ import ( type SelfLogger struct { log.Logger AboveLevel log.LogLevel - lastMsg string - lastTime int + lastMsg string + lastTime int } func NewSelfLogger() *SelfLogger { @@ -26,15 +26,14 @@ func (l *SelfLogger) Hook(e *log.Entry) { if l.lastTime > 15 { panic("selflogger same log to oftern") } - if l.lastMsg == e.Text{ + if l.lastMsg == e.Text { l.lastTime += 1 } else { l.lastMsg = e.Text l.lastTime = 1 } - database.InsertEntry("",e) + database.InsertEntry("", e) } - func (l *SelfLogger) Close() { }