-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
42 additions
and
1 deletion.
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 |
---|---|---|
@@ -1,2 +1,5 @@ | ||
# logger-go | ||
Golang logger interface and adapters | ||
|
||
Golang logger interface and adapters. | ||
This interface is used in the Golang libraries of GraphMetrics. | ||
It also provides a few adapters for popular loggers. |
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 logger | ||
|
||
import "log" | ||
|
||
type defaultLogger struct { | ||
} | ||
|
||
func NewDefault() Logger { | ||
return &defaultLogger{} | ||
} | ||
|
||
func (*defaultLogger) Debug(msg string, metadata map[string]interface{}) { | ||
log.Printf("[DEBUG] %s %#v", msg, metadata) | ||
} | ||
|
||
func (*defaultLogger) Info(msg string, metadata map[string]interface{}) { | ||
log.Printf("[INFO] %s %#v", msg, metadata) | ||
|
||
} | ||
|
||
func (*defaultLogger) Warn(msg string, metadata map[string]interface{}) { | ||
log.Printf("[WARN] %s %#v", msg, metadata) | ||
} | ||
|
||
func (*defaultLogger) Error(msg string, metadata map[string]interface{}) { | ||
log.Printf("[ERROR] %s %#v", msg, metadata) | ||
} |
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 @@ | ||
module github.com/graphmetrics/logger-go | ||
|
||
go 1.15 |
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,8 @@ | ||
package logger | ||
|
||
type Logger interface { | ||
Debug(msg string, metadata map[string]interface{}) | ||
Info(msg string, metadata map[string]interface{}) | ||
Warn(msg string, metadata map[string]interface{}) | ||
Error(msg string, metadata map[string]interface{}) | ||
} |