Skip to content

Latest commit

 

History

History
34 lines (27 loc) · 788 Bytes

README.md

File metadata and controls

34 lines (27 loc) · 788 Bytes

Log for golang, goji log, gorm log, echo log

Installation:

go get github.com/canhlinh/log4go

Usage:

  • Add the following import:
import log "github.com/canhlinh/log4go"

Example

package main

import (
	"time"
)

import log "github.com/canhlinh/log4go"

func main() {
	defer log.Close()
	log.AddFilter("stdout", log.DEBUG, log.NewConsoleLogWriter())
	log.Info("The time is now: %s", time.Now().Format("15:04:05 MST 2006/01/02"))
	log.Debug("The time is now: %s", time.Now().Format("15:04:05 MST 2006/01/02"))
	log.Warn("The time is now: %s", time.Now().Format("15:04:05 MST 2006/01/02"))
	log.Error("The time is now: %s", time.Now().Format("15:04:05 MST 2006/01/02"))
	log.Trace("The time is now: %s", time.Now().Format("15:04:05 MST 2006/01/02"))
}