loggy

package module
v0.0.0-...-9438c48 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2020 License: GPL-3.0 Imports: 4 Imported by: 2

README

loggy

Golang Logger w/ Keybase integration Go Report Card Documentation

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Log

type Log struct {
	Level LogLevel
	Msg   string
}

Log struct with type and message

func (Log) String

func (msg Log) String() string

Generate string from type Log with severity prepended

type LogLevel

type LogLevel int

LogLevel of importance for a log message

const (
	// Debug output and below
	Debug LogLevel = 5
	// Info output and below
	Info LogLevel = 4
	// Warnings and below
	Warnings LogLevel = 3
	// Errors will show by default
	Errors LogLevel = 2
	// Critical will show but can be silenced
	Critical LogLevel = 1
	// StdoutOnly for only showing via stdout
	StdoutOnly LogLevel = 0
)

type LogOpts

type LogOpts struct {

	// Output file for logging - Required for file output
	OutFile string
	// Keybase Team for logging - Required for Keybase output
	KBTeam string
	// Keybase Channel for logging - Optional for Keybase output
	KBChann string
	// Log level / verbosity (see LogLevel)
	Level LogLevel
	// Program name for Keybase logging - Required for Keybase output
	ProgName string
	// Use stdout  - Required to print to stdout
	UseStdout bool
	// contains filtered or unexported fields
}

LogOpts to be passed to NewLogger()

type Logger

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

Logger with options for logging to file, keybase or stdout. More functionality could be added within the internal handleLog() func.

func NewLogger

func NewLogger(opts LogOpts) Logger

NewLogger creates a new logger instance using LogOpts

func (Logger) Log

func (l Logger) Log(level LogLevel, msg string)

Log func, takes LogLevel and string and passes to internal handler.

func (Logger) LogCritical

func (l Logger) LogCritical(msg string, a ...interface{})

LogCritical shortcut from string - Will notifiy Keybase users

func (Logger) LogDebug

func (l Logger) LogDebug(msg string, a ...interface{})

LogDebug shortcut from string

func (Logger) LogError

func (l Logger) LogError(msg string, a ...interface{})

LogError shortcut from string - Will notify Keybase users

func (Logger) LogErrorType

func (l Logger) LogErrorType(e error)

LogErrorType for compatibility - Will notify keybase users

func (Logger) LogInfo

func (l Logger) LogInfo(msg string, a ...interface{})

LogInfo shortcut from string

func (Logger) LogMsg

func (l Logger) LogMsg(msg Log)

LogMsg takes a type Log and passes it to internal handler.

func (Logger) LogPanic

func (l Logger) LogPanic(msg string, a ...interface{})

LogPanic is a LogCritical shortcut that terminates program

func (Logger) LogWarn

func (l Logger) LogWarn(msg string, a ...interface{})

LogWarn shortcut from string

func (Logger) PanicSafe

func (l Logger) PanicSafe(a ...interface{})

PanicSafe is a deferrable function to recover from a panic operation.

Jump to

Keyboard shortcuts

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