Documentation
¶
Index ¶
- Constants
- type Log
- func (log *Log) Alert(a ...interface{})
- func (log *Log) Close()
- func (log *Log) Critical(a ...interface{})
- func (log *Log) Debug(a ...interface{})
- func (log *Log) Emergency(a ...interface{})
- func (log *Log) Error(a ...interface{})
- func (log *Log) GetPtr(level int) (*log.Logger, error)
- func (log *Log) Info(a ...interface{})
- func (log *Log) Notice(a ...interface{})
- func (log *Log) PrintfOnErr(level int, fn func() error, format string, a ...interface{})
- func (log *Log) PrintlnOnErr(level int, fn func() error, a ...interface{})
- func (log *Log) Trace(msg string) func()
- func (log *Log) Warning(a ...interface{})
Constants ¶
const ( EMERGENCY = iota // 0 ALERT // 1 CRITICAL // 2 ERROR // 3 WARNING // 4 NOTICE // 5 INFO // 6 DEBUG // 7 TRACE // 8 )
log level constants
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Log ¶
type Log struct {
// contains filtered or unexported fields
}
Log struct represents application logger
func New ¶ added in v1.1.0
New constructor for application logger
Fields:
path - path to log file level - log level, possible levels: 0 - Emergency, with panic exit. 1 - Alert, with exit 2. 2 - Critical, with ext 1. 3 - Errors. 4 - Warnings. 5 - Notice. 6 - Info. 7 - Debug. 8 - Trace.
func main() {
// initialization application log system
var err error
logger := logger.Log{}
if logger, err = logger.NewLogger("/some/path", 0); err != nil {
panic(err)
}
}
func (*Log) Critical ¶ added in v1.1.0
func (log *Log) Critical(a ...interface{})
Critical wraps println
func (*Log) Emergency ¶ added in v1.1.0
func (log *Log) Emergency(a ...interface{})
Emergency wraps println
func (*Log) GetPtr ¶ added in v1.1.0
GetPtr returns raw *log.Logger object ptr for specified logging level
func (*Log) PrintfOnErr ¶ added in v1.1.0
PrintfOnErr is a function wrap helper; it takes a function that can return an error and additional error description if wrapped function return an error we write a message describes event and handle behavior according to specified logging level further
func (*Log) PrintlnOnErr ¶ added in v1.1.0
PrintlnOnErr is a function wrap helper; it takes a function that can return an error and additional error description if wrapped function return an error we write a message describes event and handle behavior according to specified logging level further