forked from tonindexer/anton
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
48 lines (40 loc) · 961 Bytes
/
main.go
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
package main
import (
"os"
"github.com/allisson/go-env"
"github.com/urfave/cli/v2"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"github.com/tonindexer/anton/cmd/archive"
"github.com/tonindexer/anton/cmd/contract"
"github.com/tonindexer/anton/cmd/db"
"github.com/tonindexer/anton/cmd/indexer"
"github.com/tonindexer/anton/cmd/label"
"github.com/tonindexer/anton/cmd/web"
)
func init() {
zerolog.TimeFieldFormat = zerolog.TimeFormatUnix
level := zerolog.InfoLevel
if env.GetBool("DEBUG_LOGS", false) {
level = zerolog.DebugLevel
}
// add file and line number to log
log.Logger = log.With().Caller().Logger().Level(level)
}
func main() {
app := &cli.App{
Name: "anton",
Usage: "an indexing project",
Commands: []*cli.Command{
db.Command,
indexer.Command,
web.Command,
archive.Command,
contract.Command,
label.Command,
},
}
if err := app.Run(os.Args); err != nil {
log.Fatal().Err(err).Msg("")
}
}