summaryrefslogtreecommitdiff
path: root/contrib/log/log.go
diff options
context:
space:
mode:
authortjpcc <tjp@ctrl-c.club>2023-01-23 22:15:16 -0700
committertjpcc <tjp@ctrl-c.club>2023-01-23 22:15:16 -0700
commit0480e066a3f1ae97dbab8fcb6303589eb0fa724c (patch)
tree1aa347eb3691a29987475fcf6049343aa227a365 /contrib/log/log.go
parentdf57a12539030297b3254bc81f5696691cbc9c6f (diff)
logging library up to top level
Diffstat (limited to 'contrib/log/log.go')
-rw-r--r--contrib/log/log.go35
1 files changed, 0 insertions, 35 deletions
diff --git a/contrib/log/log.go b/contrib/log/log.go
deleted file mode 100644
index 0060f4e..0000000
--- a/contrib/log/log.go
+++ /dev/null
@@ -1,35 +0,0 @@
-package log
-
-import (
- "context"
- "io"
- "time"
-
- kitlog "github.com/go-kit/log"
-
- "tildegit.org/tjp/gus"
-)
-
-func Requests(out io.Writer, logger kitlog.Logger) gus.Middleware {
- if logger == nil {
- logger = kitlog.NewLogfmtLogger(kitlog.NewSyncWriter(out))
- }
-
- return func(next gus.Handler) gus.Handler {
- return func(ctx context.Context, r *gus.Request) (resp *gus.Response) {
- start := time.Now()
- defer func() {
- end := time.Now()
- logger.Log(
- "msg", "request",
- "ts", end,
- "dur", end.Sub(start),
- "url", r.URL,
- "status", resp.Status,
- )
- }()
-
- return next(ctx, r)
- }
- }
-}