mirror of
https://code.dnix.de/da/flokatirc
synced 2026-07-27 08:39:45 +02:00
Beautify logs with xlog
This commit is contained in:
+7
-6
@@ -10,11 +10,12 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"code.dnix.de/an/xlog"
|
||||
|
||||
"flokatirc/util"
|
||||
|
||||
"github.com/sorcix/irc"
|
||||
@@ -137,8 +138,8 @@ var (
|
||||
|
||||
func init() {
|
||||
MsgHandlers["twitch"] = twitchHandleMessage
|
||||
log.Println("Initializing twitch module")
|
||||
go pollStreamData()
|
||||
xlog.Info("Twitch module initialized")
|
||||
}
|
||||
|
||||
func twitchHandleMessage(m *irc.Message) {
|
||||
@@ -208,11 +209,11 @@ func getTwitchStreamObject(streamname string) TwitchStreamObject {
|
||||
var tobj TwitchStreamObject
|
||||
resp, err := http.Get(twsurl)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
xlog.Error(err.Error())
|
||||
} else {
|
||||
reader, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
xlog.Error(err.Error())
|
||||
} else {
|
||||
defer resp.Body.Close()
|
||||
json.Unmarshal(reader, &tobj)
|
||||
@@ -227,11 +228,11 @@ func getTwitchChannelObject(streamname string) TwitchChannelObject {
|
||||
var tcobj TwitchChannelObject
|
||||
resp2, err := http.Get(twcurl)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
xlog.Error(err.Error())
|
||||
} else {
|
||||
reader2, err := ioutil.ReadAll(resp2.Body)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
xlog.Error(err.Error())
|
||||
} else {
|
||||
defer resp2.Body.Close()
|
||||
json.Unmarshal(reader2, &tcobj)
|
||||
|
||||
Reference in New Issue
Block a user