Skip to content

Commit

Permalink
Use go-cli-log instead of original logging package
Browse files Browse the repository at this point in the history
  • Loading branch information
babarot committed Jan 24, 2020
1 parent 2b0fa71 commit aa19680
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 181 deletions.
10 changes: 4 additions & 6 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"os"
"runtime"

"github.com/b4b4r07/gist/pkg/logging"
clilog "github.com/b4b4r07/go-cli-log"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -40,11 +40,9 @@ func newRootCmd() *cobra.Command {

// Execute is
func Execute() error {
logWriter, err := logging.LogOutput()
if err != nil {
return err
}
log.SetOutput(logWriter)
clilog.Env = "GIST_LOG"
clilog.Path = "GIST_LOG_PATH"
clilog.SetOutput()

log.Printf("[INFO] pkg version: %s", Version)
log.Printf("[INFO] Go runtime version: %s", runtime.Version())
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ module github.com/b4b4r07/gist
go 1.12

require (
github.com/b4b4r07/go-cli-log v0.0.0-20200124120248-8fac4d71de01
github.com/caarlos0/spin v1.1.1-0.20200123125736-2bc438191c89
github.com/dustin/go-humanize v1.0.0
github.com/google/go-github v17.0.0+incompatible
github.com/google/go-querystring v1.0.0 // indirect
github.com/hashicorp/logutils v1.0.0
github.com/manifoldco/promptui v0.7.0
github.com/mattn/go-colorable v0.1.4 // indirect
github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYU
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/b4b4r07/go-cli-log v0.0.0-20200124115450-c6d0a1621967 h1:ku6R6/I1sIdcFtAzpP5qfBr5OWn981X0kmOnxIp4Mas=
github.com/b4b4r07/go-cli-log v0.0.0-20200124115450-c6d0a1621967/go.mod h1:banxIPzSdnym1ZZb48bKR3ojP9fW9fuYnM8XZeYlvbA=
github.com/b4b4r07/go-cli-log v0.0.0-20200124120248-8fac4d71de01 h1:rH+k/Ce7EpkeraV5xHl9Dd/PWPsKLX8f7HRfzumoGmA=
github.com/b4b4r07/go-cli-log v0.0.0-20200124120248-8fac4d71de01/go.mod h1:banxIPzSdnym1ZZb48bKR3ojP9fW9fuYnM8XZeYlvbA=
github.com/caarlos0/spin v1.1.1-0.20200123125736-2bc438191c89 h1:9zUBQuu3b8WvC4Um/KUXciqr0kdTw8PKIGzbzm2b2gU=
github.com/caarlos0/spin v1.1.1-0.20200123125736-2bc438191c89/go.mod h1:HOC4pUvfhjXR2yDt+sEY9dRc2m4CCaK5z5oQYAbzXSA=
github.com/chzyer/logex v1.1.10 h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE=
Expand Down
101 changes: 0 additions & 101 deletions pkg/logging/logging.go

This file was deleted.

70 changes: 0 additions & 70 deletions pkg/logging/transport.go

This file was deleted.

5 changes: 2 additions & 3 deletions pkg/spin/spin.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ package spin
import (
"io/ioutil"

"github.com/b4b4r07/gist/pkg/logging"
clilog "github.com/b4b4r07/go-cli-log"
"github.com/caarlos0/spin"
)

func New(text string) *spin.Spinner {
isLogSet := len(string(logging.LogLevel())) > 0
if isLogSet {
if clilog.IsEnabled() {
return spin.New(text, spin.WithWriter(ioutil.Discard))
}
return spin.New(text)
Expand Down

0 comments on commit aa19680

Please sign in to comment.