Added log tags to entries

This commit is contained in:
Artyom Belousov 2019-11-04 21:13:07 +03:00
parent cdd158e17c
commit b15094fa8d
2 changed files with 11 additions and 5 deletions

View file

@ -25,13 +25,13 @@ func Message(userId int64, message string) {
paramString := strings.Join(params, "&")
resp, err := http.Get(SendMessageUrl + "?" + paramString)
if err != nil || resp.StatusCode != http.StatusOK {
log.Printf("Could not send message user: %d", userId)
log.Printf("[error] Could not send message. User: %d", userId)
return
}
responseBytes, _ := ioutil.ReadAll(resp.Body)
var response SendMessageResponse
_ = json.Unmarshal(responseBytes, &response)
if response.Error.ErrorCode != 0 {
log.Printf("Message was not sent message user: %d error message: %s", userId, response.Error.ErrorMsg)
log.Printf("[error] Message was not sent. User: %d error message: %s", userId, response.Error.ErrorMsg)
}
}