Simple logger (with rainbows) for Go
Go to file
Astra a0974739c0 Change import paths 2023-01-18 00:59:19 +00:00
examples Change import paths 2023-01-18 00:59:19 +00:00
.gitignore Adding release candidate for 0.2.0 2021-02-14 00:17:49 -08:00
LICENSE Create LICENSE 2018-11-27 14:58:23 -08:00
README.md Adding release candidate for 0.2.0 2021-02-14 00:17:49 -08:00
go.mod Update go.mod 2021-12-16 14:25:23 +00:00
go.sum Adding build and dependency changing 2021-05-02 04:46:15 -07:00
logger.go Adding test for line override 2021-02-25 13:10:59 -08:00
logger_legacy.go Adding release candidate for 0.2.0 2021-02-14 00:17:49 -08:00
logger_legacy_test.go Adding release candidate for 0.2.0 2021-02-14 00:17:49 -08:00
logger_test.go Change import paths 2023-01-18 00:59:19 +00:00
screenshot.png Adding release candidate for 0.2.0 2021-02-14 00:17:49 -08:00

README.md

Kris Nóva Logger

History

  • [2017] Originally ported from it's original location in the Kubicorn code base.
  • [2021] Refactored to support custom io.Writer's

Install

go get github.com/kris-nova/logger

Basic Usage

package main

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

func main() {
	// Options
	logger.Writer = os.Stdout // This is not needed
	logger.BitwiseLevel = logger.LogCritical | logger.LogWarning // Customize your levels
	logger.BitwiseLevel = logger.LogEverything // Turn everything on
	logger.BitwiseLevel = logger.LogAlways // Only log Always()
	logger.BitwiseLevel = logger.LogEverything // Turn everything back on 
	// 
	
	// Log lines
	logger.Debug("Check this out %d", 123)
	logger.Info("Cool!")
	logger.Success("Hooray!")
	logger.Always("Hello!")
	logger.Critical("Oh No!")
	logger.Warning("Beware...")
	logger.Deprecated("Don't do this!")
	//
}

Rainbow logs


package main

import (
	"github.com/kris-nova/logger"
	lol "github.com/kris-nova/lolgopher"
)


func main(){
	//
	logger.Writer = lol.NewLolWriter()          // Sometimes this will work better
	logger.Writer = lol.NewTruecolorLolWriter() // Comment one of these out
	//

	logger.BitwiseLevel = logger.LogEverything
	logger.Always("Rainbow logging")
	logger.Always("Rainbow logging")
	logger.Always("Rainbow logging")
	logger.Always("Rainbow logging")
}