Skip to content

kevin1sMe/log4g

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

log4g

Simple go logger, such as log4j, too simple to use.

fork from github.com/cuixin/log4g

1)根据日志等级,产生不同的日志文件夹 2)日志文件按小时划分,方便查找

installation

go get github.com/kevin1sMe/log4g

usage

Add main entry to start log4g, specify the output file or not(No output set the nil argument, just only print to console)

    import "github.com/kevin1sMe/log4g"
    import "time"

    func main() {
        log4g.InitLogger(log4g.LDebug, ".")
        defer log4g.Close()
        // begin to output
        log4g.Info("hello world")

        time.Sleep(time.Second * 1)
    }

examples&benchmark

test 1000k lines to print:
$>go run examples/test.go
$>tail -f logging.log

or directly test the speed of writing bytes.
```
$>nohup go run examples/test.go >/dev/null 2>&1
$>tail -f logging.log
```

About

Simple logger for go language.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 98.5%
  • Shell 1.5%