-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
46 lines (34 loc) · 841 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
package main
import (
"fmt"
"io"
"news-scrapers-workers-eng-go/managers"
"news-scrapers-workers-eng-go/models"
"os"
"github.com/joho/godotenv"
log "github.com/sirupsen/logrus"
)
const logPath = "logs.txt"
func main() {
e := godotenv.Load()
if e != nil {
fmt.Print(e)
}
Formatter := new(log.TextFormatter)
Formatter.TimestampFormat = "02-01-2006 15:04:05"
Formatter.FullTimestamp = true
log.SetFormatter(Formatter)
f, err := os.OpenFile(logPath, os.O_WRONLY|os.O_CREATE, 0755)
if err != nil {
fmt.Println(err)
}
//log.SetOutput(f)
mw := io.MultiWriter(os.Stdout, f)
log.SetOutput(mw)
config := models.ScrapingConfig{}
config.CreateFromEnvVars()
fmt.Println(config)
var mainScraper managers.ScraperManager
mainScraper = managers.ScraperManagerAllDailyNewspapers{}
mainScraper.StartScraping(config)
}