Skip to content

Commit

Permalink
refactor: use log over fmt when possible (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
ooliver1 authored Mar 21, 2023
1 parent 46ff1ae commit 790410f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions client/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
package client

import (
"fmt"
"log"
"time"

"github.com/eludris-community/eludris.go/events"
Expand Down Expand Up @@ -35,15 +35,15 @@ func (c clientImpl) Connect() error {
for {
_, message, err := conn.ReadMessage()
if err != nil {
fmt.Printf("error: %v\n", err)
log.Printf("error: %v\n", err)
err := c.Connect()
if err != nil {
panic(err)
}

return
}
fmt.Printf("recv: %s\n", message)
log.Printf("recv: %s\n", message)
c.eventManager.Dispatch(c, message)
}
}()
Expand Down
3 changes: 2 additions & 1 deletion client/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"encoding/json"
"fmt"
"io"
"log"
"mime/multipart"
"net/http"
"net/url"
Expand Down Expand Up @@ -48,7 +49,7 @@ func (c clientImpl) request(reqType RequestType, method, path string, data Data,
return nil, err
}

fmt.Printf("Sending %s request to %s\n", method, uri.String())
log.Printf("Sending %s request to %s\n", method, uri.String())

req := http.Request{
Method: method,
Expand Down
4 changes: 2 additions & 2 deletions events/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package events
import (
"bytes"
"encoding/json"
"fmt"
"log"
"reflect"

"github.com/eludris-community/eludris.go/interfaces"
Expand Down Expand Up @@ -106,7 +106,7 @@ func (m *managerImpl) Dispatch(client interfaces.Client, data []byte) {
event = &innerEvent
}
default:
fmt.Println("Unknown event type: ", op)
log.Println("Unknown event type: ", op)

return
}
Expand Down

0 comments on commit 790410f

Please sign in to comment.