logging

package module
v0.0.0-...-0a6c8af Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2016 License: MIT Imports: 3 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogType

type LogType int

LogType represents a type and level of logging

const (
	NONE LogType = iota
	DEBUG
	INFO
	WARN
	ERROR
	FATAL
)

Constants for the type and levels of logging

func StringToLogType

func StringToLogType(logTypeName string) LogType

StringToLogType converts a specified string to a LogType. If the string does not match a specific log type the NONE is returned.

func (LogType) Color

func (logType LogType) Color() color.Attribute

Color returns the color attribute for this log type

func (LogType) String

func (logType LogType) String() string

String returns the friendly name of a specified log type/level

type Logger

type Logger struct {
	ApplicationName string
	LogLevel        LogType
	// contains filtered or unexported fields
}

Logger represents an instance of a log structure

func NewLogger

func NewLogger(applicationName string) *Logger

NewLogger creates a new Logger instance with a specific application name. The application name is a prefix used in all log messges.

func NewLoggerWithMinimumLevel

func NewLoggerWithMinimumLevel(applicationName string, logLevel LogType) *Logger

NewLoggerWithMinimumLevel creates a new Logger instance that only logs messages with a specified log type level or higher.

func (*Logger) Debug

func (logger *Logger) Debug(message ...interface{})

Debug writes a debug entry to the log

func (*Logger) Debugf

func (logger *Logger) Debugf(message string, args ...interface{})

Debugf writes a formatted debug entry to the log

func (*Logger) DisableColors

func (logger *Logger) DisableColors()

DiableColors turns of console coloring

func (*Logger) EnableColors

func (logger *Logger) EnableColors()

EnableColors turns on console coloring

func (*Logger) Error

func (logger *Logger) Error(message ...interface{})

Error writes an error message to the log

func (*Logger) Errorf

func (logger *Logger) Errorf(message string, args ...interface{})

Errorf writes a formatted error entry to the log

func (*Logger) Fatal

func (logger *Logger) Fatal(message ...interface{})

Fatal writes a fatal log messge

func (*Logger) Fatalf

func (logger *Logger) Fatalf(message string, args ...interface{})

Fatalf writes a formatted fatal entry to the log

func (*Logger) Info

func (logger *Logger) Info(message ...interface{})

Info writes an information message to the log

func (*Logger) Infof

func (logger *Logger) Infof(message string, args ...interface{})

Infof writes a formatted info entry to the log

func (*Logger) Warning

func (logger *Logger) Warning(message ...interface{})

Warning writes a warning message to the log

func (*Logger) Warningf

func (logger *Logger) Warningf(message string, args ...interface{})

Warningf writes a formatted warning entry to the log

Jump to

Keyboard shortcuts

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