Skip to content

Commit

Permalink
Remove specialized Level type due to cobra
Browse files Browse the repository at this point in the history
  • Loading branch information
iknite committed Feb 21, 2019
1 parent e0552d5 commit 0a392b6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
5 changes: 2 additions & 3 deletions cmd/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ import (
)

type cmdContext struct {
apiKey, configFile, path string
logLevel log.Level
disableConfig bool
apiKey, logLevel, configFile, path string
disableConfig bool
}

type clientContext struct {
Expand Down
16 changes: 7 additions & 9 deletions log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,12 @@ import (
"github.com/hashicorp/logutils"
)

type Level string

// Log levels constants
const (
SILENT Level = "silent"
ERROR Level = "error"
INFO Level = "info"
DEBUG Level = "debug"
SILENT = "silent"
ERROR = "error"
INFO = "info"
DEBUG = "debug"

caller = 3
)
Expand All @@ -52,9 +50,9 @@ type logger interface {
GetLogger() *log.Logger
}

func getFilter(lv Level) *logutils.LevelFilter {
func getFilter(lv string) *logutils.LevelFilter {

mapLevel := map[Level]logutils.LogLevel{
mapLevel := map[string]logutils.LogLevel{
ERROR: "ERROR",
INFO: "INFO",
DEBUG: "DEBUG",
Expand Down Expand Up @@ -141,7 +139,7 @@ func GetLogger() *log.Logger {

// SetLogger is a function that switches between verbosity loggers. Default
// is error level. Available levels are "silent", "debug", "info" and "error".
func SetLogger(namespace, lv Level) {
func SetLogger(namespace, lv string) {

prefix := fmt.Sprintf("%s: ", namespace)

Expand Down

0 comments on commit 0a392b6

Please sign in to comment.