app

package
v0.0.0-...-2be0f72 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2017 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound Item not found
	ErrNotFound = errors.New("not found")

	// ErrInvalid Invalid request
	ErrInvalid = errors.New("invalid")

	// ErrExists Item already exists
	ErrExists = errors.New("exists")

	// ErrNoAccess Access to item not allowed
	ErrNoAccess = errors.New("no access")

	// ErrInternal Internal fatal error
	ErrInternal = errors.New("internal error")

	// ErrCreate Create of object failed
	ErrCreate = errors.New("unable to create")

	// ErrUnclassified error is not classified
	ErrUnclassified = errors.New("unclassified error")
)
View Source
var (
	// Log Is the global log variable.
	Log = newLog()
)
View Source
var MCDir mcdir

MCDir gives access to methods on the MCDIR directory. It will panic if MCDIR is not set.

Functions

func DefaultLogHandler

func DefaultLogHandler() log15.Handler

DefaultLogHandler returns the current handler. It can be used to create additional logger instances that all use the same handler for output.

func Is

func Is(err error, what error) bool

Is returns true if the particular error code in an Error is equal to the expected error. This is useful comparing without having to cast and unpack.

func Logf

func Logf(format string, args ...interface{}) string

Logf is short hand to create a message string using fmt.Sprintf.

func Panicf

func Panicf(format string, args ...interface{})

Panicf will format the message and call panic.

func SetDefaultLogHandler

func SetDefaultLogHandler(handler log15.Handler)

SetDefaultLogHandler sets the handler for the logger. It wraps handlers in a SyncHandler. You should not pass in handlers that are already wrapped in a SyncHandler.

func SetLogLvl

func SetLogLvl(lvl log15.Lvl)

Sets a new log level for the global logging and the default handler.

Types

type Error

type Error struct {
	Err     error  // Error code
	Message string // Message related to error
}

Error holds the error code and additional messages.

func Errorf

func Errorf(err error, message string, args ...interface{}) *Error

Errorf takes and error, a message string and a set of arguments and produces a new Error.

func (*Error) Error

func (e *Error) Error() string

Implement error interface.

type Logger

type Logger struct {
	log15.Logger
}

Logger holds the application logger

func NewLog

func NewLog(ctx ...interface{}) *Logger

NewLog creates a new instance of the logger using the current default handler for its output.

func (*Logger) Critf

func (l *Logger) Critf(format string, args ...interface{})

Critf will write a formatted Crit to the default log.

func (*Logger) Debugf

func (l *Logger) Debugf(format string, args ...interface{})

Debugf will write a formatted Debug to the default log.

func (*Logger) Errorf

func (l *Logger) Errorf(format string, args ...interface{})

Errorf will write a formatted Error to the default log.

func (*Logger) Exitf

func (l *Logger) Exitf(format string, args ...interface{})

func (*Logger) Infof

func (l *Logger) Infof(format string, args ...interface{})

Infof will write a formatted Info to the default log.

func (*Logger) Panicf

func (l *Logger) Panicf(format string, args ...interface{})

func (*Logger) Warnf

func (l *Logger) Warnf(format string, args ...interface{})

Warnf will write a formatted Warn to the default log.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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