Skip to content

Commit

Permalink
added code to panic log
Browse files Browse the repository at this point in the history
  • Loading branch information
sdpsagarpawar committed Mar 8, 2022
1 parent 3fe1b2e commit 16ff6f7
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module logger

go 1.17
30 changes: 30 additions & 0 deletions panic.go
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)
}

0 comments on commit 16ff6f7

Please sign in to comment.