Skip to content

thanakritr/go-logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-logger

Logger for Golang

Install

go get github.com/i14t/go-logger

Example

package main

import (
  "github.com/i14t/go-logger"
)

func main() {
  opts := logger.LoggerOptions{
    Level:      "debug",
    Name:       "DEMO",
    HideCaller: false,
  }
  log := logger.NewLogger(opts)
  log.Debug("I am a debug log")
  log.Info("I am a info log")
  log.Warn("I am a warn log")
  log.Error("I am a error log")
}

Output

2024-05-01 23:38:56.256 +07:00 [go] 🟪 DEBUG  [DEMO] [example/main.go:14 main.main] I am a debug log
2024-05-01 23:38:56.256 +07:00 [go] ⬜️ INFO   [DEMO] [example/main.go:15 main.main] I am a info log
2024-05-01 23:38:56.256 +07:00 [go] 🟧 WARN   [DEMO] [example/main.go:16 main.main] I am a warn log
2024-05-01 23:38:56.256 +07:00 [go] 🟥 ERROR  [DEMO] [example/main.go:17 main.main] I am a error log

Reference

License

Licensed under the MIT License - see the LICENSE file for details.

About

Zab leveled logging in Go.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors