-
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
1 parent
3fe1b2e
commit 16ff6f7
Showing
2 changed files
with
33 additions
and
0 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,3 @@ | ||
module logger | ||
|
||
go 1.17 |
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,30 @@ | ||
package logger | ||
|
||
import "log" | ||
|
||
type Logger interface { | ||
Panic(interface{}) | ||
Panicf(string, interface{}) | ||
Panicln(interface{}) | ||
} | ||
|
||
type logger struct{} | ||
|
||
func NewLogger() Logger { | ||
return &logger{} | ||
} | ||
|
||
//Panic use to panic with normal message | ||
func (l *logger) Panic(msg interface{}) { | ||
log.Panic(msg) | ||
} | ||
|
||
//Panicf used to panic with formatted message | ||
func (l *logger) Panicf(format string, body interface{}) { | ||
log.Panicf(format, body) | ||
} | ||
|
||
//Panicln used to panic with println | ||
func (l *logger) Panicln(msg interface{}) { | ||
log.Panicln(msg) | ||
} |