loglevel

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2016 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package loglevel provides a way to filter log messages depending on their log level.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Log

func Log(messagelevel LogLevel, message interface{})

Log a message if the messagelevel is below or equal to the set LogLevel. For example, if the package is set to InfoMessage, then ErrorMessage, WarnMessage, and InfoMessage would be printed, but DebugMessage and TraceMessage would not be.

func Logf

func Logf(messagelevel LogLevel, format string, a ...interface{})

Logf is a wrapper around Log(). It first formats the log message using the provided format string.

func Set

func Set(level LogLevel)

Set the package's message level.

Types

type LogLevel

type LogLevel int

LogLevel defines a hirarchy of levels for classifing log messages.

const (
	ErrorMessage LogLevel = iota
	WarnMessage
	InfoMessage
	DebugMessage
	TraceMessage
)

An enumeration of LogLevels.

func ParseLogLevel

func ParseLogLevel(parseThis string) (LogLevel, error)

ParseLogLevel parses a string, returns a log level.

func (LogLevel) String

func (level LogLevel) String() string

Return the string representation of the LogLevel.

Jump to

Keyboard shortcuts

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