-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from imranismail/chore/build-flags
Setup build flags
- Loading branch information
Showing
7 changed files
with
66 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package logger | ||
|
||
import ( | ||
"github.com/rs/zerolog" | ||
"github.com/spf13/viper" | ||
) | ||
|
||
type Logger struct { | ||
zlog zerolog.Logger | ||
} | ||
|
||
func (logger *Logger) Infof(format string, args ...interface{}) { | ||
logger.zlog.Info().Msgf(format, args...) | ||
} | ||
|
||
func (logger *Logger) Debugf(format string, args ...interface{}) { | ||
logger.zlog.Debug().Msgf(format, args...) | ||
} | ||
|
||
func (logger *Logger) Errorf(format string, args ...interface{}) { | ||
logger.zlog.Error().Msgf(format, args...) | ||
} | ||
|
||
func (logger *Logger) Configure() { | ||
level, err := zerolog.ParseLevel(viper.GetString("verbosity")) | ||
|
||
if err != nil { | ||
logger.zlog.Fatal().Msgf("Failed to parse verbosity: %v", err) | ||
} | ||
|
||
logger.zlog = logger.zlog.Level(level) | ||
} | ||
|
||
func NewLogger() Logger { | ||
zlog := zerolog.New(zerolog.NewConsoleWriter()).With().Timestamp().Logger() | ||
logger := Logger{zlog} | ||
logger.Configure() | ||
return logger | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package meta | ||
|
||
var Version = "development" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters