feat: introduce structured, field logging (#87)

* feat: introduce structured, field logging

The logging is currently minimal and only for initial message of listening and user login attempts

* chore: major version upgarde

there was a breaking API change in 8cd6d0a585 for which the git tag was v4.0.0 but the Go SIV was missed. This commit updates the SIV and retracts the defective version of v4.1.0.
This commit is contained in:
Mohammed Al Sahaf
2021-10-19 17:45:54 +00:00
committed by GitHub
parent 5701cbb5b8
commit 8a8650d9b2
8 changed files with 64 additions and 89 deletions
+2 -25
View File
@@ -1,32 +1,9 @@
package main
import (
"context"
"github.com/hacdias/webdav/v3/lib"
"log"
"os"
"os/signal"
"runtime"
"syscall"
"time"
"github.com/hacdias/webdav/v3/cmd"
"github.com/hacdias/webdav/v4/cmd"
)
func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
ctx, cancel := context.WithCancel(context.Background())
go lib.LastRequestLogIndex(ctx)
go cmd.Execute()
sigterm := make(chan os.Signal, 1)
signal.Notify(sigterm, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
<-sigterm
log.Println("receive stop signal")
cancel()
// wait for other goroutines to quit
time.Sleep(2 * time.Second)
cmd.Execute()
}