A simple leveled logging library with coloured output.
Go Makefile
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 30 commits ahead of AreaHQ:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
vendor/github.com
.gitignore
.travis.yml
Gopkg.lock
Gopkg.toml
LICENSE
Makefile
README.md
coloured_formatter.go
coloured_formatter_test.go
default_formatter.go
default_formatter_test.go
formatter_interface.go
gometalinter.json
interface.go
logger.go

README.md

Logging

A simple leveled logging library with coloured output.

Travis Status for RichardKnop/logging godoc for RichardKnop/logging codecov for RichardKnop/logging


Log levels:

  • INFO (blue)
  • WARNING (pink)
  • ERROR (red)
  • FATAL (red)

Formatters:

  • DefaultFormatter
  • ColouredFormatter

Example usage. Create a new package log in your app such that:

package log

import (
	"github.com/RichardKnop/logging"
)

var (
	logger = logging.New(nil, nil, new(logging.ColouredFormatter))

	// INFO ...
	INFO = logger[logging.INFO]
	// WARNING ...
	WARNING = logger[logging.WARNING]
	// ERROR ...
	ERROR = logger[logging.ERROR]
	// FATAL ...
	FATAL = logger[logging.FATAL]
)

Then from your app you could do:

package main

import (
	"github.com/yourusername/yourapp/log"
)

func main() {
	log.INFO.Print("log message")
}