Skip to content

Commit

Permalink
add http logging
Browse files Browse the repository at this point in the history
  • Loading branch information
vintikzzz committed May 5, 2020
1 parent 94828fd commit 53dab89
Show file tree
Hide file tree
Showing 9 changed files with 215 additions and 2 deletions.
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
module github.com/webtor-io/srt2vtt

go 1.12
go 1.14

require (
github.com/asticode/go-astilog v1.4.0 // indirect
github.com/asticode/go-astisub v0.2.0
github.com/asticode/go-astitools v1.3.0 // indirect
github.com/bakins/logrus-middleware v0.0.0-20180426214643-ce4c6f8deb07
github.com/djimenez/iconv-go v0.0.0-20160305225143-8960e66bd3da
github.com/gogs/chardet v0.0.0-20150115103509-2404f7772561
github.com/joonix/log v0.0.0-20190524090622-13fe31bbdd7a
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ github.com/asticode/go-astits v1.2.0/go.mod h1:1Tvjdozd9RwgwOUteaxmd0Sutyo+kTO24
github.com/asticode/go-astits v1.3.0 h1:tlf2E0uNpL769FQr/2fZSvH1gEG5dqWezfaspGvfd+M=
github.com/asticode/go-astits v1.3.0/go.mod h1:Dp78dEuksl+pWzlXTkpdd91U1QDX9r57db1XpLHm5Mw=
github.com/asticode/go-astiws v1.0.1/go.mod h1:5F/0RkJTq1SZ0TsiheD3j/9lr9kla70c2q7w1aAG78Q=
github.com/bakins/logrus-middleware v0.0.0-20180426214643-ce4c6f8deb07 h1:YyWvJqruuX4aBN812F9ex3WXuxdqruVNd5rvww8U9ko=
github.com/bakins/logrus-middleware v0.0.0-20180426214643-ce4c6f8deb07/go.mod h1:Z+aq7HgFBRFKVDlBpL/cgrb94A9VgwMSlsFAxAJeK6s=
github.com/certifi/gocertifi v0.0.0-20190506164543-d2eda7129713 h1:UNOqI3EKhvbqV8f1Vm3NIwkrhq388sGCeAH2Op7w0rc=
github.com/certifi/gocertifi v0.0.0-20190506164543-d2eda7129713/go.mod h1:GJKEexRPVJrBSOjoqN5VNOIKJ5Q3RViH6eu3puDRwx4=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
Expand Down
9 changes: 8 additions & 1 deletion services/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"net"
"net/http"

logrusmiddleware "github.com/bakins/logrus-middleware"
joonix "github.com/joonix/log"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
)
Expand Down Expand Up @@ -48,8 +50,13 @@ func (s *Web) Serve() error {
}
io.WriteString(w, data)
})
logger := log.New()
logger.SetFormatter(joonix.NewFormatter())
l := logrusmiddleware.Middleware{
Logger: logger,
}
log.Infof("Serving Web at %v", addr)
return http.Serve(ln, mux)
return http.Serve(ln, l.Handler(mux, ""))
}

func (s *Web) Close() {
Expand Down
24 changes: 24 additions & 0 deletions vendor/github.com/bakins/logrus-middleware/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions vendor/github.com/bakins/logrus-middleware/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions vendor/github.com/bakins/logrus-middleware/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions vendor/github.com/bakins/logrus-middleware/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

114 changes: 114 additions & 0 deletions vendor/github.com/bakins/logrus-middleware/middleware.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
# github.com/asticode/go-astikit v0.2.0
github.com/asticode/go-astikit
# github.com/asticode/go-astilog v1.4.0
## explicit
# github.com/asticode/go-astisub v0.2.0
## explicit
github.com/asticode/go-astisub
# github.com/asticode/go-astitools v1.3.0
## explicit
# github.com/asticode/go-astits v1.3.0
github.com/asticode/go-astits
# github.com/bakins/logrus-middleware v0.0.0-20180426214643-ce4c6f8deb07
## explicit
github.com/bakins/logrus-middleware
# github.com/djimenez/iconv-go v0.0.0-20160305225143-8960e66bd3da
## explicit
github.com/djimenez/iconv-go
# github.com/gogs/chardet v0.0.0-20150115103509-2404f7772561
## explicit
github.com/gogs/chardet
# github.com/golang/protobuf v1.3.1
github.com/golang/protobuf/proto
Expand All @@ -16,14 +26,18 @@ github.com/golang/protobuf/ptypes/any
github.com/golang/protobuf/ptypes/duration
github.com/golang/protobuf/ptypes/timestamp
# github.com/joonix/log v0.0.0-20190524090622-13fe31bbdd7a
## explicit
github.com/joonix/log
# github.com/konsorten/go-windows-terminal-sequences v1.0.2
github.com/konsorten/go-windows-terminal-sequences
# github.com/pkg/errors v0.8.1
## explicit
github.com/pkg/errors
# github.com/sirupsen/logrus v1.4.2
## explicit
github.com/sirupsen/logrus
# github.com/urfave/cli v1.21.0
## explicit
github.com/urfave/cli
# golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e
golang.org/x/sys/unix
Expand Down

0 comments on commit 53dab89

Please sign in to comment.