log

package
v0.0.0-...-e42d106 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2016 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package log aims at providing level based logging while still supporting all the code written in go's native log package.

In short

log.Log method lets you log the data with levels. log.SetMinLevel lets you set minimum level to log. There are 7 levels. There are also helper methods for you to run those logs.

log.VERB
log.DEBU
log.INFO
log.NOTI
log.WARN
log.ERRO
log.CRIT

Compatibility

The package is also compatible with go's built in log pkg. it respects any prefix you set, it will output to any output writer you set. Also, any code written using the package works with this package seamlessly. it contains all the helper funcs present in go's log pkg. By default it logs into INFO level

BUG(kittuov@gmail.com): adding file name flag just prints out log file number line rather than the calling file line number.

~~BUG(kittuov@gmail.com): No color for flags in log eg: time, short_file, date etc.~~

Use this package's methods to write logs any where

Index

Constants

View Source
const (
	VERB = 0
	DEBU = 1
	INFO = 2
	NOTI = 3
	WARN = 4
	ERRO = 5
	CRIT = 6
)

Variables

This section is empty.

Functions

func Critical

func Critical(v ...interface{})

Critical logs

func Criticalf

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

func Debug

func Debug(v ...interface{})

Debug Methods

func Debugf

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

func Error

func Error(v ...interface{})

Error logs

func Errorf

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

func Info

func Info(v ...interface{})

Info logs

func Infof

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

func Log

func Log(level int, v ...interface{})

Log takes in level of the log and data to log. if the logging fails or unable to log, it does not panic or return error. Best practice is to use the levels set in this package eg., log.INFO, log.DEBU, log.WARN etc.,

func Notice

func Notice(v ...interface{})

Notice logs

func Noticef

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

func SetMin

func SetMin(level int) error

SetMin sets the minimum level to log into the system

func Verbose

func Verbose(v ...interface{})

Verbose Methods

func Verbosef

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

func Warn

func Warn(v ...interface{})

Notice logs

func Warnf

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

Types

type LevelDoesNotExist

type LevelDoesNotExist int

func (LevelDoesNotExist) Error

func (l LevelDoesNotExist) Error() string

Jump to

Keyboard shortcuts

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