Skip to content
master
Go to file
Code
This branch is 32 commits ahead of AreaHQ:master.

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Logging

A simple leveled logging library with coloured output.

Travis Status for RichardKnop/logging godoc 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")
}

About

A simple leveled logging library with coloured output.

Topics

Resources

License

Releases

No releases published
You can’t perform that action at this time.