pwnlog

package module
v0.0.0-...-de69235 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2022 License: MIT Imports: 2 Imported by: 0

README

pwnlog

Dead-simple, leveled-logging in Golang, pwn style. Colors and message prefixes are as the universe intended them to be:

   debug    -> [*] debugging text
   info     -> [+] info text
   warning  -> [-] warning text
   error    -> [!] error text
   fatal    -> [!!] fatal error text (followed by death of program)

Example usage:

    logger := pwnlog.New(pwnlog.DebugLevel)
    logger.Debug("this is debug output!")

    logger.SetLevel(pwnlog.InfoLevel)
    logger.Debug("you should NOT see this debug output")
    logger.Info("changed log level to %s", "info")
    logger.Warning("warning: error code %d", 42)
    logger.Error("ERROR!")

    // goodbye program
    logger.Fatal("F A T A L")

which produces the following:

pwnlog screenshot

Documentation

Index

Constants

View Source
const (
	DebugLevel int = iota
	InfoLevel
	WarningLevel
	ErrorLevel
	FatalLevel
)

Define the logging levels as an enum

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger struct

func New

func New(level int) *Logger

Create a new logger

func (*Logger) Debug

func (l *Logger) Debug(format string, v ...interface{})

func (*Logger) Error

func (l *Logger) Error(format string, v ...interface{})

func (*Logger) Fatal

func (l *Logger) Fatal(format string, v ...interface{})

func (*Logger) Info

func (l *Logger) Info(format string, v ...interface{})

func (*Logger) SetLevel

func (l *Logger) SetLevel(level int)

func (*Logger) Warning

func (l *Logger) Warning(format string, v ...interface{})

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL