-
Notifications
You must be signed in to change notification settings - Fork 12
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 #111 from ArtisanCloud/develop
feat(log): add dummyLogger
- Loading branch information
Showing
3 changed files
with
92 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package drivers | ||
|
||
type DummyLogger struct{} | ||
|
||
func (l *DummyLogger) Debug(msg string, v ...interface{}) {} | ||
|
||
func (l *DummyLogger) Info(msg string, v ...interface{}) {} | ||
|
||
func (l *DummyLogger) Warn(msg string, v ...interface{}) {} | ||
|
||
func (l *DummyLogger) Error(msg string, v ...interface{}) {} | ||
|
||
func (l *DummyLogger) Panic(msg string, v ...interface{}) {} | ||
|
||
func (l *DummyLogger) Fatal(msg string, v ...interface{}) {} | ||
|
||
func (l *DummyLogger) DebugF(format string, args ...interface{}) {} | ||
|
||
func (l *DummyLogger) InfoF(format string, args ...interface{}) {} | ||
|
||
func (l *DummyLogger) WarnF(format string, args ...interface{}) {} | ||
|
||
func (l *DummyLogger) ErrorF(format string, args ...interface{}) {} | ||
|
||
func (l *DummyLogger) PanicF(format string, args ...interface{}) {} | ||
|
||
func (l *DummyLogger) FatalF(format string, args ...interface{}) {} |
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,65 @@ | ||
package drivers | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
) | ||
|
||
const ( | ||
DebugLevel int8 = 0 | ||
InfoLevel int8 = 1 | ||
WarningLevel int8 = 2 | ||
ErrorLevel int8 = 3 | ||
PanicLevel int8 = 4 | ||
FatalLevel int8 = 5 | ||
) | ||
|
||
type SimpleLogger struct{} | ||
|
||
func (l *SimpleLogger) Debug(msg string, v ...interface{}) { | ||
log.Printf("[DEBUG] "+msg, v...) | ||
} | ||
|
||
func (l *SimpleLogger) Info(msg string, v ...interface{}) { | ||
log.Printf("[INFO] "+msg, v...) | ||
} | ||
|
||
func (l *SimpleLogger) Warn(msg string, v ...interface{}) { | ||
log.Printf("[WARNING] "+msg, v...) | ||
} | ||
|
||
func (l *SimpleLogger) Error(msg string, v ...interface{}) { | ||
log.Printf("[ERROR] "+msg, v...) | ||
} | ||
|
||
func (l *SimpleLogger) Panic(msg string, v ...interface{}) { | ||
log.Panicf("[PANIC] "+msg, v...) | ||
} | ||
|
||
func (l *SimpleLogger) Fatal(msg string, v ...interface{}) { | ||
log.Fatalf("[FATAL] "+msg, v...) | ||
} | ||
|
||
func (l *SimpleLogger) DebugF(format string, args ...interface{}) { | ||
l.Debug(fmt.Sprintf(format, args...)) | ||
} | ||
|
||
func (l *SimpleLogger) InfoF(format string, args ...interface{}) { | ||
l.Info(fmt.Sprintf(format, args...)) | ||
} | ||
|
||
func (l *SimpleLogger) WarnF(format string, args ...interface{}) { | ||
l.Warn(fmt.Sprintf(format, args...)) | ||
} | ||
|
||
func (l *SimpleLogger) ErrorF(format string, args ...interface{}) { | ||
l.Error(fmt.Sprintf(format, args...)) | ||
} | ||
|
||
func (l *SimpleLogger) PanicF(format string, args ...interface{}) { | ||
l.Panic(fmt.Sprintf(format, args...)) | ||
} | ||
|
||
func (l *SimpleLogger) FatalF(format string, args ...interface{}) { | ||
l.Fatal(fmt.Sprintf(format, args...)) | ||
} |
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