Skip to content

Commit

Permalink
improve
Browse files Browse the repository at this point in the history
  • Loading branch information
jedmccaleb committed Jun 22, 2022
1 parent d7f34a5 commit 05703e3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 21 deletions.
39 changes: 20 additions & 19 deletions easylog.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,53 +51,54 @@ func Init(options ...func()) error {
return nil
}

func Debug(msg string, v ...interface{}) {
checkFile()

func Debug(a ...any) {
if level <= DEBUG {
checkFile()
msg := fmt.Sprint(a...)
fmtMsg := format(DEBUG, msg)
fmt.Println(fmtMsg)
logger.Printf(fmtMsg, v...)
logger.Println(fmtMsg)
}
}

func Info(msg string, v ...interface{}) {
checkFile()

func Info(a ...any) {
if level <= INFO {
checkFile()
msg := fmt.Sprint(a...)
fmtMsg := format(INFO, msg)
fmt.Println(fmtMsg)
logger.Printf(fmtMsg, v...)
logger.Println(fmtMsg)
}
}

func Warn(msg string, v ...interface{}) {
checkFile()

func Warn(a ...any) {
if level <= WARN {
checkFile()
msg := fmt.Sprint(a...)
fmtMsg := format(WARN, msg)
fmt.Println(fmtMsg)
logger.Printf(fmtMsg, v...)
logger.Println(fmtMsg)
}
}

func Error(msg string, v ...interface{}) {
checkFile()

func Error(a ...any) {
if level <= ERROR {
checkFile()
msg := fmt.Sprint(a...)
fmtMsg := format(ERROR, msg)
fmt.Println(fmtMsg)
logger.Printf(fmtMsg, v...)
logger.Println(fmtMsg)
}
}

func Fatal(msg string, v ...interface{}) {
checkFile()
func Fatal(a ...any) {

if level <= FATAL {
checkFile()
msg := fmt.Sprint(a...)
fmtMsg := format(FATAL, msg)
fmt.Println(fmtMsg)
logger.Fatalf(fmtMsg, v...)
logger.Println(fmtMsg)
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/example1.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func main() {
defer wg.Done()

for j := 0; j < 100; j++ {
log.Info("EXAMPLE: %d", j)
log.Info("EXAMPLE: ", j)
}
}()
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/Astera-org/easylog

go 1.12
go 1.18

0 comments on commit 05703e3

Please sign in to comment.