-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
38 lines (33 loc) · 805 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
package main
import (
"log/slog"
"os"
"sokwva/acfun/dougaInfo/cache"
"sokwva/acfun/dougaInfo/conf"
"sokwva/acfun/dougaInfo/server"
)
var slogger slog.Logger
func logLevelMap(str string) slog.Level {
var logMap map[string]slog.Level = map[string]slog.Level{
"debug": slog.LevelDebug,
"info": slog.LevelInfo,
"warn": slog.LevelWarn,
"error": slog.LevelError,
}
return logMap[str]
}
func initLogger() {
slogger = *slog.New(slog.NewTextHandler(os.Stdout, &slog.HandlerOptions{
Level: logLevelMap("info"),
}))
}
func main() {
initLogger()
conf.InitConfDriver()
slogger.Debug("initLogger.")
cacheInitErr := cache.Start()
if cacheInitErr != nil {
slogger.Warn("cacheDrv connect faild,about 15s late would be happen. error message: " + cacheInitErr.Error())
}
server.Start()
}