-
Notifications
You must be signed in to change notification settings - Fork 1
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 #20 from sambaiz/feature/check_commmand_exitcode
improve logging
- Loading branch information
Showing
11 changed files
with
108 additions
and
51 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
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,42 @@ | ||
package logger | ||
|
||
import "go.uber.org/zap" | ||
|
||
// Loggerer is interface of Logger | ||
type Loggerer interface { | ||
Info(msg string, fields ...zap.Field) | ||
Error(msg string, fields ...zap.Field) | ||
} | ||
|
||
// Logger logs | ||
type Logger struct { | ||
logger *zap.Logger | ||
} | ||
|
||
// New Logger | ||
func New() *Logger { | ||
logger, err := zap.NewProduction() | ||
if err != nil { | ||
panic(err) | ||
} | ||
return &Logger{ | ||
logger: logger, | ||
} | ||
} | ||
|
||
// Info log | ||
func (l *Logger) Info(msg string, fields ...zap.Field) { | ||
l.logger.Info(msg, fields...) | ||
} | ||
|
||
// Error log | ||
func (l *Logger) Error(msg string, fields ...zap.Field) { | ||
l.logger.Error(msg, fields...) | ||
} | ||
|
||
// MockLogger is logger for test | ||
type MockLogger struct {} | ||
// Info log | ||
func (l MockLogger) Info(msg string, fields ...zap.Field) {} | ||
// Error log | ||
func (l MockLogger) Error(msg string, fields ...zap.Field) {} |
Oops, something went wrong.