-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.go
More file actions
61 lines (51 loc) · 1.4 KB
/
Main.go
File metadata and controls
61 lines (51 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package main
import (
"flag"
"fmt"
"os"
"github.com/ricardoaat/bioschemas-govalid/config"
"github.com/ricardoaat/bioschemas-govalid/validator"
"github.com/rifflock/lfshook"
log "github.com/sirupsen/logrus"
)
var (
version string
buildDate string
)
func logInit() {
//now := time.Now()
//logfile := config.Conf.Path.LogPath + fmt.Sprintf("govalid_%s.log", now.Format("20060102T150405"))
logfile := config.Conf.Path.LogPath + "govalid.log"
fmt.Println("Loging to " + logfile)
log.SetOutput(os.Stdout)
log.SetLevel(log.DebugLevel)
log.SetFormatter(&log.TextFormatter{})
pathMap := lfshook.PathMap{
log.DebugLevel: logfile,
log.InfoLevel: logfile,
log.ErrorLevel: logfile,
log.WarnLevel: logfile,
log.PanicLevel: logfile,
}
log.AddHook(lfshook.NewHook(
pathMap,
&log.JSONFormatter{},
))
}
func main() {
err := config.LoadConfig("config.toml")
if err != nil {
fmt.Println("Couldn't load config.toml ", err)
}
logInit()
log.Info("--------------Init program--------------")
log.Info(fmt.Sprintf("Version: %s Build Date: %s", version, buildDate))
log.Debug("Loaded configuration " + fmt.Sprint(config.Conf))
v := flag.Bool("v", false, "Returns the binary version and built date info")
f := flag.String("f", "", "File path to Bioschemas CSV file to parse")
u := flag.String("u", "", "Url Path to Bioschemas CSV info to parse")
flag.Parse()
if !*v {
validator.Validate(*f, *u)
}
}