Go-Log is a utility log package built to customize the Go's normal log package. Prominent features are
- Tag the logs into debug and error variant.
- Add/Remove Timestamp to logs
- Get the calling function details in logs
- Synchronized with mutex locks to handle multiple logging
go get github.com/MindorksOpenSource/Go-Log
import (
"github.com/MindorksOpenSource/Go-Log"
)
func main() {
golog.D("A basic primitive debug log.")
}
This golog prints the message without any extra information like:
$ A basic primitive debug log.
func main() {
golog.E("This a basic primitive error log.")
}
This golog prints the message while tagging it as an ERROR like:
$ [ERROR] This a basic primitive error log.
// Adds time to the log
golog.ConfigureTimer()
// Adds the calling function path to log
golog.ConfigureCallingFunction()
func main() {
golog.ConfigureTimer()
golog.D("A debug log with time")
}
This golog prints the message with its timestamp like:
$ 2018/10/29 15:52:24 A debug log with time
func main() {
golog.ConfigureCallingFunction()
golog.D("A debug log with calling function")
}
This golog prints the message with its timestamp like:
$ [main.main] A debug log with calling function
You can use both the configurations together also. Go gophers!