dlog

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2018 License: Apache-2.0 Imports: 8 Imported by: 75

Documentation

Overview

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

We'll probably replace this with an independent logging library down the line

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateLogFile

func CreateLogFile()

CreateLogFile creates a file in the 'logs' directory of the starting point of this program to write logs to

func Error

func Error(in ...interface{})

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

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 FileWrite

func FileWrite(in ...interface{})

FileWrite runs dLog, but JUST writes to file instead of also to stdout.

func Info

func Info(in ...interface{})

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

func SetDebugFilter

func SetDebugFilter(filter string)

SetDebugFilter sets the string which determines what debug messages get printed. Only messages which contain the filer as a pseudo-regex

func SetDebugLevel

func SetDebugLevel(dL LogLevel)

SetDebugLevel sets what message levels of debug will be printed.

func SetStringDebugLevel

func SetStringDebugLevel(debugL string)

SetStringDebugLevel parses the input string as one of the debug levels

func Verb

func Verb(in ...interface{})

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

func Warn

func Warn(in ...interface{})

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

Types

type LogLevel

type LogLevel int

LogLevel represents the levels a debug message can have

const (
	NONE LogLevel = iota
	ERROR
	WARN
	INFO
	VERBOSE
)

Logging levels

func GetLogLevel

func GetLogLevel() LogLevel

GetLogLevel returns the current log level, i.e WARN or INFO...

Jump to

Keyboard shortcuts

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