Skip to content

CodyGuo/glog

Repository files navigation

Golang log library

godoc build status

Package glog implements a log infrastructure for Go.

Example

Let's have a look at an example which demonstrates most of the features found in this library.

package main

import (
	"os"

	"github.com/CodyGuo/glog"
)

func main() {
	glog.Debug("hello debug")
	glog.Info("hello info")

	customLog := glog.New(os.Stdout,
		glog.WithLevel(glog.TRACE),
                glog.WithLevelLength(4),
		glog.WithFlags(glog.LglogFlags),
		glog.WithPrefix("[customLog] "))

	customLog.Trace("hello trace")
	customLog.Debug("hello debug")
	customLog.Info("hello info")
	customLog.Notice("hello notice")
	customLog.Warning("hello warning")
	customLog.Error("hello error")
	customLog.Critical("hello critical")
}

Installing

Using go get

$ go get github.com/CodyGuo/glog

You can use go get -u to update the package.

Go test

$ go test -bench . -benchmem

image

Documentation

For docs, see http://godoc.org/github.com/CodyGuo/glog or run:

$ godoc github.com/CodyGuo/glog