logsip

package module
v0.0.0-...-4adbcae Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2018 License: MIT Imports: 10 Imported by: 0

README

Logsip

GoDoc Build Status Go Report Card

A simple, concise, colorful logger for Go that's sorta like logrus, but lighter and built on top of the standard log library.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IsTerminal = isatty.IsTerminal(os.Stdout.Fd())

IsTerminal defines whether we have a terminal or not

Functions

func Debug

func Debug(v ...interface{})

Debug works just like log.Print, but with a Purple "DEBUG[0000]" prefix.

func Debugf

func Debugf(format string, v ...interface{})

Debugf works just like log.Printf, but with a Purple "DEBUG[0000]" prefix.

func Debugln

func Debugln(v ...interface{})

Debugln works just like log.Println, but with a Purple "DEBUG[0000]" prefix.

func Error

func Error(v ...interface{})

Error works just like log.Print, but with a Red "ERROR[0000]" prefix.

func Errorf

func Errorf(format string, v ...interface{})

Errorf works just like log.Printf, but with a Red "ERROR[0000]" prefix.

func Errorln

func Errorln(v ...interface{})

Errorln works just like log.Println, but with a Red "ERROR[0000]" prefix.

func Fatal

func Fatal(v ...interface{})

Fatal works just like log.Fatal, but with a Red "FATAL[0000]" prefix.

func Fatalf

func Fatalf(format string, v ...interface{})

Fatalf works just like log.Fatalf, but with a Red "FATAL[0000]" prefix.

func Fatalln

func Fatalln(v ...interface{})

Fatalln works just like log.Fatalln, but with a Red "FATAL[0000]" prefix.

func Info

func Info(v ...interface{})

Info works just like log.Print, but with a Blue "INFO[0000]" prefix.

func Infof

func Infof(format string, v ...interface{})

Infof works just like log.Printf, but with a Blue "INFO[0000]" prefix.

func Infoln

func Infoln(v ...interface{})

Infoln works just like log.Println, but with a Blue "INFO[0000]" prefix.

func Panic

func Panic(v ...interface{})

Panic works just like log.Panic, but with a Red "PANIC[0000]" prefix.

func Panicf

func Panicf(format string, v ...interface{})

Panicf works just like log.Panicf, but with a Red "PANIC[0000]" prefix.

func Panicln

func Panicln(v ...interface{})

Panicln works just like log.Panicln, but with a Red "PANIC[0000]" prefix.

func SetLevel

func SetLevel(level Level)

SetLevel is a function to set the log level (i.e Info, Warn, Debug, etc.)

func SetOutput

func SetOutput(w io.Writer)

SetOutput allows you to use the global logger with any io.Writer

func Warn

func Warn(v ...interface{})

Warn works just like log.Print, but with a Yellow "WARN[0000]" prefix.

func Warnf

func Warnf(format string, v ...interface{})

Warnf works just like log.Printf, but with a Yellow "WARN[0000]" prefix.

func Warnln

func Warnln(v ...interface{})

Warnln works just like log.Println, but with a Yellow "WARN[0000]" prefix.

Types

type Level

type Level uint8

Level is a type that represents the log level

const (
	// PanicLevel is the lowest level
	PanicLevel Level = iota
	FatalLevel
	ErrorLevel
	WarnLevel
	InfoLevel
	DebugLevel
)

func GetLevel

func GetLevel() Level

GetLevel is a function to get the current log level

func (Level) String

func (level Level) String() string

type Logger

type Logger struct {
	Level Level

	*log.Logger
	// contains filtered or unexported fields
}

func New

func New() *Logger

New returns a new logger

func (*Logger) Debug

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

Debug works just like log.Print, but with a Purple "DEBUG[0000]" prefix.

func (*Logger) Debugf

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

Debugf works just like log.Printf, but with a Purple "DEBUG[0000]" prefix.

func (*Logger) Debugln

func (l *Logger) Debugln(v ...interface{})

Debugln works just like log.Println, but with a Purple "DEBUG[0000]" prefix.

func (*Logger) Error

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

Error works just like log.Print, but with a Red "ERROR[0000]" prefix.

func (*Logger) Errorf

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

Errorf works just like log.Printf, but with a Red "ERROR[0000]" prefix.

func (*Logger) Errorln

func (l *Logger) Errorln(v ...interface{})

Errorln works just like log.Println, but with a Red "ERROR[0000]" prefix.

func (*Logger) Fatal

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

Fatal works just like log.Fatal, but with a Red "FATAL[0000]" prefix.

func (*Logger) Fatalf

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

Fatalf works just like log.Fatalf, but with a Red "FATAL[0000]" prefix.

func (*Logger) Fatalln

func (l *Logger) Fatalln(v ...interface{})

Fatalln works just like log.Fatalln, but with a Red "FATAL[0000]" prefix.

func (*Logger) GetLevel

func (logger *Logger) GetLevel() Level

GetLevel is a method to get the current log level

func (*Logger) Info

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

Info works just like log.Print, but with a Blue "INFO[0000]" prefix.

func (*Logger) Infof

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

Infof works just like log.Printf, but with a Blue "INFO[0000]" prefix.

func (*Logger) Infoln

func (l *Logger) Infoln(v ...interface{})

Infoln works just like log.Println, but with a Blue "INFO[0000]" prefix.

func (*Logger) Panic

func (l *Logger) Panic(v ...interface{})

Panic works just like log.Panic, but with a Red "PANIC[0000]" prefix.

func (*Logger) Panicf

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

Panicf works just like log.Panicf, but with a Red "PANIC[0000]" prefix.

func (*Logger) Panicln

func (l *Logger) Panicln(v ...interface{})

Panicln works just like log.Panicln, but with a Red "PANIC[0000]" prefix.

func (*Logger) SetLevel

func (logger *Logger) SetLevel(level Level)

SetLevel is a method to set the log level (i.e Info, Warn, Debug, etc.)

func (*Logger) SetOutput

func (logger *Logger) SetOutput(w io.Writer)

func (*Logger) Warn

func (l *Logger) Warn(v ...interface{})

Warn works just like log.Print, but with a Yellow "WARN[0000]" prefix.

func (*Logger) Warnf

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

Warnf works just like log.Printf, but with a Yellow "WARN[0000]" prefix.

func (*Logger) Warnln

func (l *Logger) Warnln(v ...interface{})

Warnln works just like log.Println, but with a Yellow "WARN[0000]" prefix.

Jump to

Keyboard shortcuts

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