Simple logger (with rainbows) for Go
Go to file
Kris Nova fd0d87064b
Merge pull request #2 from christopherhein/feature/timestamps-flag
adding support for turning off timestamps
2018-11-27 15:58:38 -08:00
example Porting from kubicorn 2018-11-27 14:47:56 -08:00
LICENSE Create LICENSE 2018-11-27 14:58:23 -08:00
README.md Adding screenshot 2018-11-27 14:53:14 -08:00
logger.go adding support for turning off timestamps 2018-11-27 23:23:56 +00:00
logger_test.go adding support for turning off timestamps 2018-11-27 23:23:56 +00:00
screenshot.png Adding screenshot 2018-11-27 14:53:14 -08:00

README.md

logger

Ported from it's original location in the Kubicorn code base.

Rainbow logs


package main

import (
	"github.com/kris-nova/logger"
	"fmt"
	"os"
)


func main(){

	logger.Fabulous = true
	logger.Color = false
	logger.Level = 4

	err := fmt.Errorf("New error")

	logger.Always("This is always printed")

	logger.Success("Hooray a good thing happened!")

	logger.Info("we found an error: %v", err)

	logger.Debug("this is a useful message for software enigneers")

	logger.Warning("something bad happened but the software can still run")

	// Notice this does *NOT* exit!
	logger.Critical("the software should stop running, this is bad")

	// Now we have to exit
	os.Exit(123)
}

Simple golang logger

package main

import (
	"github.com/kris-nova/logger"
	"fmt"
	"os"
)


func main(){

	// Most Verbose
	//logger.Level = 4

	// Normal
	// No info or debug messages, only warnings and criticals
	logger.Level = 2

	// Off
	//logger.Level = 0

	err := fmt.Errorf("New error")
	logger.Info("we found an error: %v", err)

	logger.Debug("this is a useful message for software enigneers")

	logger.Warning("something bad happened but the software can still run")

	// Notice this does *NOT* exit!
	logger.Critical("the software should stop running, this is bad")

	// Now we have to exit
	os.Exit(123)
}