dlog

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2018 License: Apache-2.0 Imports: 9 Imported by: 76

Documentation

Overview

Package dlog provides logging functions with caller file and line information, logging levels and level and text filters.

Index

Constants

This section is empty.

Variables

View Source
var CreateLogFile = func() {}

CreateLogFile creates a file for logs to be written to by log functions. This is a NOP if fullOakLogger is not set by SetLogger.

View Source
var Error = func(...interface{}) {}

Error will write a log if the debug level is not NONE

View Source
var FileWrite = func(...interface{}) {}

FileWrite logs by writing to file (if possible) but does not log to console as well. This is a NOP if fullOakLogger is not set by SetLogger.

View Source
var GetLogLevel = func() Level {
	return NONE
}

GetLogLevel returns the log level of the fullOakLogger, or NONE if there is not fullOakLogger.

View Source
var Info = func(...interface{}) {}

Info will write a log if the debug level is higher than WARN

View Source
var SetDebugFilter = func(string) {}

SetDebugFilter defines a string that all logs should be checked against-- if the log message does not contain the input string the log will not log. This is a NOP if fullOakLogger is not set by SetLogger.

View Source
var SetDebugLevel = func(Level) {}

SetDebugLevel sets the log level of the fullOakLogger. This is a NOP if fullOakLogger is not set by SetLogger.

View Source
var Verb = func(...interface{}) {}

Verb will write a log if the debug level is higher than INFO

View Source
var Warn = func(...interface{}) {}

Warn will write a log if the debug level is higher than ERROR

Functions

func ErrorCheck added in v1.4.0

func ErrorCheck(in error)

ErrorCheck checks that the input is not nil, then calls Error on it if it is not. Otherwise it does nothing.

func SetLogger

func SetLogger(l Logger)

SetLogger defines what logger should be used for oak's internal logging. If this is NOT called before oak.Init is called (assuming this is being used with oak), then it will be called with the default logger as a part of oak.Init.

Types

type FullLogger

type FullLogger interface {
	Logger
	GetLogLevel() Level
	FileWrite(in ...interface{})
	SetDebugFilter(filter string)
	SetDebugLevel(dL Level)
	CreateLogFile()
}

A FullLogger supports, in addition to Logger's functions, the ability to set and get a log level, and create and write logs directly to file.

type Level

type Level int

Level represents the levels a debug message can have

const (
	NONE Level = iota
	ERROR
	WARN
	INFO
	VERBOSE
)

Level values const

func ParseDebugLevel

func ParseDebugLevel(s string) (Level, error)

ParseDebugLevel parses the input string as a known debug levels

type Logger

type Logger interface {
	Error(...interface{})
	Warn(...interface{})
	Info(...interface{})
	Verb(...interface{})
}

A Logger is a minimal log interface for the content oak wants to log: four levels of logging.

func NewLogger

func NewLogger() Logger

NewLogger returns an instance of the default logger with no filter, no file, and level set to ERROR

Jump to

Keyboard shortcuts

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