level

package
v0.0.0-...-5bc14d6 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2016 License: MIT Imports: 1 Imported by: 6

Documentation

Overview

Package level defines the standard levels and their validations

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InvalidLogLevelError

type InvalidLogLevelError struct {
	InvalidValue *LogLevel
	InvalidName  *string
}

InvalidLogLevelError is an error representing an invalid log level occurrence

func (InvalidLogLevelError) Error

func (e InvalidLogLevelError) Error() string

Error satisfies the error interface by returning a string message

type LogLevel

type LogLevel uint8

A LogLevel defines a logging severity level, akin to the severity levels used in the Syslog standard. (https://tools.ietf.org/html/rfc5424)

const (
	EMERGENCY LogLevel = iota
	ALERT
	CRITICAL
	ERROR
	WARNING
	NOTICE
	INFO
	DEBUG
)

The log severity levels, as defined in RFC 5424 (Section 6.2.1): https://tools.ietf.org/html/rfc5424#section-6.2.1

func All

func All() []LogLevel

All returns an array of the standard defined log levels

func NewLogLevel

func NewLogLevel(name string) (LogLevel, error)

NewLogLevel gets a log level value by a string name

func (LogLevel) IsValid

func (l LogLevel) IsValid() (bool, error)

IsValid checks if a log level is valid based on the standard defined levels

func (LogLevel) String

func (l LogLevel) String() string

String gets the name of a given log level constant

Jump to

Keyboard shortcuts

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