-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.go
More file actions
33 lines (31 loc) · 715 Bytes
/
app.go
File metadata and controls
33 lines (31 loc) · 715 Bytes
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
package main
import (
"github.com/lunny/tango"
"github.com/lunny/log"
"QRCodeService/Actions"
"QRCodeService/setting"
)
func main() {
setting.LoadConfig()
var s log.ByType
switch setting.AppLogFileFormat {
case "ByHour":
s=log.ByHour
case "ByMonth":
s=log.ByMonth
default:
s=log.ByDay
}
w := log.NewFileWriter(log.FileOptions{
ByType:s,
Dir:"./logs",
})
log.Std.SetOutput(w)
l := log.New(w, "["+setting.AppName +"_"+ setting.AppVer+"]", log.Ldefault())
l.SetOutputLevel(setting.AppLogLevel)
t := tango.Classic(l)
t.Any("/GetQR", new(Actions.GennerateQR))
t.Get("*", tango.File(setting.IndexFileUri))
t.Get("/QrCode/:name", tango.Dir(setting.QRCodeSaveDir))
t.Run(setting.AppPort)
}