A simple leveled logging library with coloured output.
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")
}