Added error logging

This commit is contained in:
Artyom Belousov 2019-11-02 22:49:32 +03:00
parent 4ad7d8286e
commit 8830920900
6 changed files with 47 additions and 7 deletions

11
main.go
View file

@ -1,14 +1,21 @@
package main
import (
"log"
"math/rand"
"os"
"time"
"github.com/flygrounder/go-mtg-vk/vk"
"github.com/gin-gonic/gin"
"math/rand"
"time"
)
func main() {
rand.Seed(time.Now().UTC().UnixNano())
logFile, _ := os.OpenFile("logs/errors.log", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
defer logFile.Close()
log.SetOutput(logFile)
r := gin.Default()
r.POST("callback/message", vk.HandleMessage)
r.Run(":80")