-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
58 lines (50 loc) · 1.87 KB
/
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
49
50
51
52
53
54
55
56
57
58
package main
import (
"fmt"
"io"
"os"
"time"
log "github.com/sirupsen/logrus"
"gopkg.in/natefinch/lumberjack.v2"
"loggicat.com/publicwatcher/internal/app/pkg/config"
"loggicat.com/publicwatcher/internal/app/pkg/util"
watcher "loggicat.com/publicwatcher/internal/app/watcher"
)
func main() {
logo := `
_ ___ ____ ____ ____ __ ____ ______ __ __ ____ ______ __ __ __ ___ ____
| | / \ / | / || | / ] / || | | |__| | / || | / ]| | | / _]| \
| | | || __|| __| | | / / | o || | | | | || o || | / / | | | / [_ | D )
| |___ | O || | || | | | | / / | ||_| |_| | | | || ||_| |_| / / | _ || _]| /
| || || |_ || |_ | | | / \_ | _ | | | | ' ' || _ | | | / \_ | | || [_ | \
| || || || | | | \ || | | | | \ / | | | | | \ || | || || . \
|_____| \___/ |___,_||___,_||____| \____||__|__| |__| \_/\_/ |__|__| |__| \____||__|__||_____||__|\_| API Ver`
fmt.Print(logo)
fmt.Print("\n\n\n")
log.SetFormatter(&log.TextFormatter{FullTimestamp: true, TimestampFormat: time.RFC3339})
lumberjacklog := &lumberjack.Logger{
Filename: "logs/loggicatWatcher.log",
MaxSize: 5000,
MaxBackups: 180,
MaxAge: 180,
Compress: false,
}
logMultiWriter := io.MultiWriter(os.Stdout, lumberjacklog)
log.SetOutput(logMultiWriter)
configFile := "./configs/watcherConfig.json"
if configFile == "" {
config.GenerateConfig()
}
watcher := watcher.Watcher{}
watcher.Init(configFile)
switch watcher.OperationMode {
case "scan":
util.PrintGreen("Switched to Scan Mode")
watcher.ScanFiles()
case "monitor":
util.PrintGreen("Switched to Monitor Mode")
go watcher.GetRelease()
watcher.ScanFiles()
watcher.MonitorFiles()
}
}