Documentation ¶
Overview ¶
Package log provides logging utility.
It abstracts the logger from the standard log package, allowing the developer to pick the logging target, changing this to a file, or syslog, for example.
Index ¶
- Variables
- func Debug(v string)
- func Debugf(format string, v ...interface{})
- func Error(v error)
- func Errorf(format string, v ...interface{})
- func Fatal(v string)
- func Fatalf(format string, v ...interface{})
- func GetStdLogger() *log.Logger
- func Init() error
- func SetLogger(logger Logger)
- func WrapError(err error) error
- func Write(w io.Writer, content []byte) error
- type Logger
- type Target
- func (t *Target) Debug(v string)
- func (t *Target) Debugf(format string, v ...interface{})
- func (t *Target) Error(v error)
- func (t *Target) Errorf(format string, v ...interface{})
- func (t *Target) Fatal(v string)
- func (t *Target) Fatalf(format string, v ...interface{})
- func (t *Target) GetStdLogger() *log.Logger
- func (t *Target) SetLogger(l Logger)
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultTarget = new(Target)
Functions ¶
func Debugf ¶
func Debugf(format string, v ...interface{})
Debugf is a wrapper for DefaultTarget.Debugf.
func Errorf ¶
func Errorf(format string, v ...interface{})
Errorf is a wrapper for DefaultTarget.Errorf.
func Fatalf ¶
func Fatalf(format string, v ...interface{})
Fatalf is a wrapper for DefaultTarget.Errorf.
func GetStdLogger ¶
GetStdLogger is a wrapper for DefaultTarget.GetStdLogger.
Types ¶
type Logger ¶
type Logger interface { Error(string) Errorf(string, ...interface{}) Fatal(string) Fatalf(string, ...interface{}) Debug(string) Debugf(string, ...interface{}) GetStdLogger() *log.Logger }
func NewFileLogger ¶
func NewMultiLogger ¶
type Target ¶
type Target struct {
// contains filtered or unexported fields
}
Target is the current target for the log package.
func (*Target) GetStdLogger ¶
GetStdLogger returns a standard Logger instance useful for configuring log in external packages.
Click to show internal directories.
Click to hide internal directories.