Categorygithub.com/kris-nova/logger
modulepackage
0.2.2
Repository: https://github.com/kris-nova/logger.git
Documentation: pkg.go.dev

# README

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")
}

# Packages

No description provided by the author

# Functions

Always.
Critical.
Debug.
Used to show deprecated log lines.
Info.
LineBytes will format a log line, and return a slice of bytes []byte.
Success.
Warning.

# Constants

[Log Constants] These are the bitwise values for the various log options.
No description provided by the author
No description provided by the author
No description provided by the author
Enable all Logging levels [127].
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

BitwiseLevel is the preferred way of managing log levels.
Color is no longer used deprecated.
Layout is the time layout string to use.
Level is the legacy log level 0 (Least verbose) 1 2 3 4 (Most verbose) deprecated.
Line will format a log line, and return a string.
TestMode is used for running the regression tests.
Timestamps are used to toggle timestamps deprecated.
A custom io.Writer to use regardless of Mode.

# Type aliases

No description provided by the author
No description provided by the author