logthis

package
Version: v0.40.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2021 License: MIT Imports: 8 Imported by: 6

Documentation

Overview

Package logthis provides a way to either print, log, and/or send a string to channels. Provides a default logger initiated on import.

Index

Constants

View Source
const (
	NORMAL = iota
	VERBOSE
	VERBOSEST
	VERBOSESTEST
)

Variables

View Source
var (
	ErrInvalidLogLevel = errors.New("invalid log level")
)

Functions

func CheckLevel added in v0.36.2

func CheckLevel(value int) error

func Error

func Error(err error, level int)

Error logs errors with a given level.

func ErrorIfNotNil added in v0.17.0

func ErrorIfNotNil(errs []error, level int)

ErrorIfNotNil logs non-nil errors from a slice.

func Info

func Info(msg string, level int)

Info logs strings with a given level, optionally sending info to chans.

func SetLevel

func SetLevel(value int)

func SetOutputWriter added in v0.37.0

func SetOutputWriter(writer io.Writer)

func SetStdOutput

func SetStdOutput(value bool)

func Subscribe added in v0.7.0

func Subscribe() chan interface{}

func TimedError added in v0.33.0

func TimedError(err error, level int)

TimedError logs an error prefixed with the time elapsed since the program started.

func TimedInfo added in v0.18.1

func TimedInfo(msg string, level int)

TimedInfo logs a message prefixed with the time elapsed since the program started.

func Unsubscribe added in v0.7.0

func Unsubscribe(msgCh chan interface{})

Types

type LogThis

type LogThis struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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