ipld-eth-server/main.go

32 lines
569 B
Go
Raw Normal View History

package main
import (
2018-11-21 04:47:01 +00:00
"os"
"github.com/spf13/viper"
"github.com/vulcanize/vulcanizedb/cmd"
2019-09-11 03:37:12 +00:00
"github.com/sirupsen/logrus"
)
func main() {
logrus.SetFormatter(&logrus.TextFormatter{
FullTimestamp: true,
})
logfile := viper.GetString("logfile")
if logfile != "" {
file, err := os.OpenFile(logfile,
os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
if err == nil {
logrus.SetOutput(file)
} else {
logrus.SetOutput(os.Stdout)
logrus.Info("Failed to log to file, using default stdout")
}
2018-11-21 04:47:01 +00:00
} else {
logrus.SetOutput(os.Stdout)
2018-11-21 04:47:01 +00:00
}
cmd.Execute()
}