Documentation ¶
Index ¶
- Variables
- func DefaultLogHandler() log15.Handler
- func Is(err error, what error) bool
- func Logf(format string, args ...interface{}) string
- func Panicf(format string, args ...interface{})
- func SetDefaultLogHandler(handler log15.Handler)
- func SetLogLvl(lvl log15.Lvl)
- type Error
- type Logger
- func (l *Logger) Critf(format string, args ...interface{})
- func (l *Logger) Debugf(format string, args ...interface{})
- func (l *Logger) Errorf(format string, args ...interface{})
- func (l *Logger) Exitf(format string, args ...interface{})
- func (l *Logger) Infof(format string, args ...interface{})
- func (l *Logger) Panicf(format string, args ...interface{})
- func (l *Logger) Warnf(format string, args ...interface{})
Constants ¶
This section is empty.
Variables ¶
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") )
var (
// Log Is the global log variable.
Log = newLog()
)
var MCDir mcdir
MCDir gives access to methods on the MCDIR directory. It will panic if MCDIR is not set.
Functions ¶
func DefaultLogHandler ¶
DefaultLogHandler returns the current handler. It can be used to create additional logger instances that all use the same handler for output.
func Is ¶
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 Panicf ¶
func Panicf(format string, args ...interface{})
Panicf will format the message and call panic.
func SetDefaultLogHandler ¶
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.
Types ¶
type Error ¶
Error holds the error code and additional messages.
type 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.