Skip to content

Commit

Permalink
replace std log module with sirupsen/logrus
Browse files Browse the repository at this point in the history
  • Loading branch information
dundee committed Jun 7, 2021
1 parent 68d20a0 commit 549e54d
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 4 deletions.
3 changes: 2 additions & 1 deletion cmd/gdu/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package app
import (
"fmt"
"io"
"log"
"os"
"runtime"

log "github.com/sirupsen/logrus"

"github.com/dundee/gdu/v5/build"
"github.com/dundee/gdu/v5/internal/common"
"github.com/dundee/gdu/v5/pkg/analyze"
Expand Down
6 changes: 6 additions & 0 deletions cmd/gdu/app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,19 @@ import (
"strings"
"testing"

log "github.com/sirupsen/logrus"

"github.com/dundee/gdu/v5/internal/testapp"
"github.com/dundee/gdu/v5/internal/testdev"
"github.com/dundee/gdu/v5/internal/testdir"
"github.com/dundee/gdu/v5/pkg/device"
"github.com/stretchr/testify/assert"
)

func init() {
log.SetLevel(log.WarnLevel)
}

func TestVersion(t *testing.T) {
out, err := runApp(
&Flags{ShowVersion: true},
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ require (
github.com/mattn/go-isatty v0.0.12
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/rivo/tview v0.0.0-20210217110421-8a8f78a6dd01
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/spf13/cobra v1.1.3
github.com/stretchr/testify v1.6.1
golang.org/x/sys v0.0.0-20210525143221-35b2ab0089ea // indirect
Expand Down
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
Expand Down Expand Up @@ -255,6 +257,7 @@ golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand Down
3 changes: 2 additions & 1 deletion internal/common/ignore.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package common

import (
"log"
"regexp"
"strings"

log "github.com/sirupsen/logrus"

"github.com/dundee/gdu/v5/pkg/analyze"
)

Expand Down
6 changes: 6 additions & 0 deletions internal/common/ignore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@ package common_test
import (
"testing"

log "github.com/sirupsen/logrus"

"github.com/dundee/gdu/v5/internal/common"
"github.com/stretchr/testify/assert"
)

func init() {
log.SetLevel(log.WarnLevel)
}

func TestCreateIgnorePattern(t *testing.T) {
re, err := common.CreateIgnorePattern([]string{"[abc]+"})

Expand Down
3 changes: 2 additions & 1 deletion pkg/analyze/dir.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package analyze

import (
"log"
"os"
"path/filepath"
"runtime"

log "github.com/sirupsen/logrus"
)

// CurrentProgress struct
Expand Down
6 changes: 6 additions & 0 deletions pkg/analyze/dir_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@ import (
"sort"
"testing"

log "github.com/sirupsen/logrus"

"github.com/dundee/gdu/v5/internal/testdir"
"github.com/stretchr/testify/assert"
)

func init() {
log.SetLevel(log.WarnLevel)
}

func TestAnalyzeDir(t *testing.T) {
fin := testdir.CreateTestDir()
defer fin()
Expand Down
6 changes: 6 additions & 0 deletions stdout/stdout_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@ import (
"bytes"
"testing"

log "github.com/sirupsen/logrus"

"github.com/dundee/gdu/v5/internal/testanalyze"
"github.com/dundee/gdu/v5/internal/testdev"
"github.com/dundee/gdu/v5/internal/testdir"
"github.com/dundee/gdu/v5/pkg/device"
"github.com/stretchr/testify/assert"
)

func init() {
log.SetLevel(log.WarnLevel)
}

func TestAnalyzePath(t *testing.T) {
fin := testdir.CreateTestDir()
defer fin()
Expand Down
3 changes: 2 additions & 1 deletion tui/tui.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package tui

import (
"fmt"
"log"
"os"
"sort"
"time"

log "github.com/sirupsen/logrus"

"github.com/dundee/gdu/v5/internal/common"
"github.com/dundee/gdu/v5/pkg/analyze"
"github.com/dundee/gdu/v5/pkg/device"
Expand Down
6 changes: 6 additions & 0 deletions tui/tui_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"errors"
"testing"

log "github.com/sirupsen/logrus"

"github.com/dundee/gdu/v5/internal/testanalyze"
"github.com/dundee/gdu/v5/internal/testapp"
"github.com/dundee/gdu/v5/internal/testdev"
Expand All @@ -14,6 +16,10 @@ import (
"github.com/stretchr/testify/assert"
)

func init() {
log.SetLevel(log.WarnLevel)
}

func TestFooter(t *testing.T) {
app, simScreen := testapp.CreateTestAppWithSimScreen(15, 15)
defer simScreen.Fini()
Expand Down

0 comments on commit 549e54d

Please sign in to comment.