Skip to content
This repository has been archived by the owner on Mar 2, 2021. It is now read-only.

Commit

Permalink
improve logging
Browse files Browse the repository at this point in the history
  • Loading branch information
hoshsadiq committed Oct 8, 2019
1 parent a3d5d21 commit d8847c2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/hoshsadiq/goval v1.0.1-0.20190525223338-f1ea9f026acd h1:tHcmy00GNwixuQJNhxkc+H26/2Wlra770XSz2Ck7jlQ=
github.com/hoshsadiq/goval v1.0.1-0.20190525223338-f1ea9f026acd/go.mod h1:vH861Ggnz+sJfUC83x8FDGOKmaXih51ENtmYjJcSdhI=
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
Expand Down
8 changes: 4 additions & 4 deletions logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ import (
)

var logger *logrus.Logger
var callerinfo = getPackage() + "/"
var basePkg = getPackage()

func Get() *logrus.Logger {
if logger == nil {
logger = logrus.New()

logger.SetFormatter(&logrus.TextFormatter{
DisableColors: true,
FullTimestamp: true,
CallerPrettyfier: func(f *runtime.Frame) (string, string) {
repopath := strings.Split(f.File, callerinfo)[1]
return fmt.Sprintf("%s()", f.Function), fmt.Sprintf("%s:%d", repopath, f.Line)
repopath := strings.Split(f.File, basePkg+"/")[1]
fnc := strings.Split(f.Function, basePkg+"/")[1]
return fmt.Sprintf("%s()", fnc), fmt.Sprintf("%s:%d", repopath, f.Line)
},
})

Expand Down
7 changes: 6 additions & 1 deletion m3u/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ func GetPlaylist(conf *config.Config) (streams Streams, allFailed bool) {
continue
}

log.Infof("reading from provider %s://%s", u.Scheme, u.Host)
if u.Scheme == "file" {
log.Infof("reading from provider %s", u)
} else {
log.Infof("reading from provider %s://%s", u.Scheme, u.Host)
}

resp, err := client.Get(provider.Uri)
if err != nil {
errors++
Expand Down

0 comments on commit d8847c2

Please sign in to comment.