feat(log): tee logs to file and stdout (#42)

This commit is contained in:
Hexxa 2021-03-06 10:44:24 +08:00 committed by GitHub
parent 6bd8d2422b
commit 9b2157ac6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 98 additions and 22 deletions

View file

@ -35,10 +35,8 @@ func main() {
if len(opts.Configs) > 0 {
for _, configPath := range opts.Configs {
if strings.HasSuffix(configPath, ".yml") || strings.HasSuffix(configPath, ".yaml") {
fmt.Printf("launching config: %s\n", configPath)
cfg, err = cfg.Load(gocfg.YAML(configPath))
} else if strings.HasSuffix(configPath, ".json") {
fmt.Printf("launching config: %s\n", configPath)
cfg, err = cfg.Load(gocfg.JSON(configPath))
} else {
panic(fmt.Sprintf("unknown config file type (.yml .yaml .json are supported): %s", configPath))
@ -65,7 +63,6 @@ func main() {
panic(err)
}
fmt.Printf("quickshare is listening %d\n", cfg.GrabInt("Server.Port"))
err = srv.Start()
if err != nil {
panic(err)