mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
audit errors and warnings.
This commit is contained in:
parent
49c48b3200
commit
c2fe224562
@ -98,10 +98,10 @@ func init() {
|
||||
|
||||
if err := viper.ReadInConfig(); err != nil {
|
||||
if _, ok := err.(viper.ConfigFileNotFoundError); !ok {
|
||||
log.Error().Err(err)
|
||||
log.Err(err)
|
||||
}
|
||||
if config != "" {
|
||||
log.Error().Err(err)
|
||||
log.Err(err)
|
||||
}
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ func init() {
|
||||
logger.Warn().Msg("preflight complete without config file")
|
||||
} else {
|
||||
if _, err := os.Stat(file); os.IsNotExist(err) {
|
||||
logger.Error().Msg("preflight complete with nonexistent config file")
|
||||
logger.Err(err).Msg("preflight complete with nonexistent config file")
|
||||
} else {
|
||||
logger.Info().Msg("preflight complete")
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ func (manager *DesktopManagerCtx) Start() {
|
||||
Msgf("setting initial screen size")
|
||||
|
||||
if err := xorg.ChangeScreenSize(manager.config.ScreenWidth, manager.config.ScreenHeight, manager.config.ScreenRate); err != nil {
|
||||
manager.logger.Warn().Err(err).Msg("unable to set initial screen size")
|
||||
manager.logger.Err(err).Msg("unable to set initial screen size")
|
||||
}
|
||||
|
||||
go xevent.EventLoop(manager.config.Display)
|
||||
|
@ -32,9 +32,7 @@ func HttpJsonResponse(w http.ResponseWriter, status int, res interface{}) {
|
||||
w.WriteHeader(status)
|
||||
|
||||
if err := json.NewEncoder(w).Encode(res); err != nil {
|
||||
log.Warn().Err(err).
|
||||
Str("module", "http").
|
||||
Msg("failed writing json error response")
|
||||
log.Err(err).Str("module", "http").Msg("sending http json response failed")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ func (manager *ImageCtx) Start() {
|
||||
manager.desktop.OnCursorChanged(func(serial uint64) {
|
||||
entry, err := manager.GetCached(serial)
|
||||
if err != nil {
|
||||
manager.logger.Warn().Err(err).Msg("failed to get cursor image")
|
||||
manager.logger.Err(err).Msg("failed to get cursor image")
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ func (manager *WebRTCManagerCtx) CreatePeer(session types.Session, videoID strin
|
||||
|
||||
videoTrack, err := webrtc.NewTrackLocalStaticSample(videoStream.Codec().Capability, "video", "stream")
|
||||
if err != nil {
|
||||
logger.Warn().Err(err).Msg("unable to create video track")
|
||||
logger.Err(err).Msg("unable to create video track")
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@ -177,7 +177,7 @@ func (manager *WebRTCManagerCtx) CreatePeer(session types.Session, videoID strin
|
||||
// should be stream started
|
||||
if videoStream.ListenersCount() == 0 {
|
||||
if err := videoStream.Start(); err != nil {
|
||||
logger.Warn().Err(err).Msg("unable to start video pipeline")
|
||||
logger.Err(err).Msg("unable to start video pipeline")
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
@ -246,7 +246,7 @@ func (manager *WebRTCManagerCtx) CreatePeer(session types.Session, videoID strin
|
||||
|
||||
cursorImage := func(entry *cursor.ImageEntry) {
|
||||
if err := peer.SendCursorImage(entry.Cursor, entry.Image); err != nil {
|
||||
logger.Warn().Err(err).Msg("could not send cursor image")
|
||||
logger.Err(err).Msg("could not send cursor image")
|
||||
}
|
||||
}
|
||||
|
||||
@ -256,7 +256,7 @@ func (manager *WebRTCManagerCtx) CreatePeer(session types.Session, videoID strin
|
||||
}
|
||||
|
||||
if err := peer.SendCursorPosition(x, y); err != nil {
|
||||
logger.Warn().Err(err).Msg("could not send cursor position")
|
||||
logger.Err(err).Msg("could not send cursor position")
|
||||
}
|
||||
}
|
||||
|
||||
@ -304,7 +304,7 @@ func (manager *WebRTCManagerCtx) CreatePeer(session types.Session, videoID strin
|
||||
if err == nil {
|
||||
cursorImage(entry)
|
||||
} else {
|
||||
logger.Warn().Err(err).Msg("failed to get cursor image")
|
||||
logger.Err(err).Msg("failed to get cursor image")
|
||||
}
|
||||
|
||||
// send initial cursor position
|
||||
@ -323,7 +323,7 @@ func (manager *WebRTCManagerCtx) CreatePeer(session types.Session, videoID strin
|
||||
}
|
||||
|
||||
if err = manager.handle(message, session); err != nil {
|
||||
logger.Warn().Err(err).Msg("data handle failed")
|
||||
logger.Err(err).Msg("data handle failed")
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -131,7 +131,7 @@ func (manager *WebSocketManagerCtx) Start() {
|
||||
|
||||
data, err := manager.desktop.ClipboardGetText()
|
||||
if err != nil {
|
||||
manager.logger.Warn().Err(err).Msg("could not get clipboard content")
|
||||
manager.logger.Err(err).Msg("could not get clipboard content")
|
||||
return
|
||||
}
|
||||
|
||||
@ -169,7 +169,7 @@ func (manager *WebSocketManagerCtx) Upgrade(w http.ResponseWriter, r *http.Reque
|
||||
|
||||
connection, err := upgrader.Upgrade(w, r, nil)
|
||||
if err != nil {
|
||||
manager.logger.Error().Err(err).Msg("failed to upgrade connection")
|
||||
manager.logger.Err(err).Msg("failed to upgrade connection")
|
||||
return
|
||||
}
|
||||
|
||||
@ -183,7 +183,7 @@ func (manager *WebSocketManagerCtx) Upgrade(w http.ResponseWriter, r *http.Reque
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
manager.logger.Error().Err(err).Msg("failed to create disconnect event")
|
||||
manager.logger.Err(err).Msg("failed to create disconnect event")
|
||||
}
|
||||
|
||||
err = connection.WriteJSON(
|
||||
@ -193,7 +193,7 @@ func (manager *WebSocketManagerCtx) Upgrade(w http.ResponseWriter, r *http.Reque
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
manager.logger.Error().Err(err).Msg("failed to send disconnect event")
|
||||
manager.logger.Err(err).Msg("failed to send disconnect event")
|
||||
}
|
||||
|
||||
if err := connection.Close(); err != nil {
|
||||
@ -297,7 +297,7 @@ func (manager *WebSocketManagerCtx) handle(connection *websocket.Conn, session t
|
||||
case raw := <-bytes:
|
||||
data := types.WebSocketMessage{}
|
||||
if err := json.Unmarshal(raw, &data); err != nil {
|
||||
logger.Error().Err(err).Msg("message unmarshalling has failed")
|
||||
logger.Err(err).Msg("message unmarshalling has failed")
|
||||
break
|
||||
}
|
||||
|
||||
@ -323,7 +323,7 @@ func (manager *WebSocketManagerCtx) handle(connection *websocket.Conn, session t
|
||||
return
|
||||
case <-ticker.C:
|
||||
if err := connection.WriteMessage(websocket.PingMessage, nil); err != nil {
|
||||
logger.Error().Err(err).Msg("ping message has failed")
|
||||
logger.Err(err).Msg("ping message has failed")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ func (peer *WebSocketPeerCtx) Send(event string, payload interface{}) {
|
||||
|
||||
raw, err := json.Marshal(payload)
|
||||
if err != nil {
|
||||
peer.logger.Error().Err(err).Str("event", event).Msg("message marshalling has failed")
|
||||
peer.logger.Err(err).Str("event", event).Msg("message marshalling has failed")
|
||||
return
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ func (peer *WebSocketPeerCtx) Send(event string, payload interface{}) {
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
peer.logger.Error().Err(err).Str("event", event).Msg("send message error")
|
||||
peer.logger.Err(err).Str("event", event).Msg("send message error")
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user