mirror of https://github.com/docker/docs.git
Update logrus
Signed-off-by: Ben Firshman <ben@firshman.co.uk>
This commit is contained in:
parent
24574d513a
commit
e0b18fee7d
|
@ -14,8 +14,8 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/Sirupsen/logrus",
|
"ImportPath": "github.com/Sirupsen/logrus",
|
||||||
"Comment": "v0.6.0-5-gf92b795",
|
"Comment": "v0.6.1",
|
||||||
"Rev": "f92b7950b372b1db80bd3527e4d40e42555fe6c2"
|
"Rev": "1f2ba2c6317323dd667bd266c1e8ebffc4a4c62f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/digitalocean/godo",
|
"ImportPath": "github.com/digitalocean/godo",
|
||||||
|
|
|
@ -206,11 +206,18 @@ import (
|
||||||
log "github.com/Sirupsen/logrus"
|
log "github.com/Sirupsen/logrus"
|
||||||
"github.com/Sirupsen/logrus/hooks/airbrake"
|
"github.com/Sirupsen/logrus/hooks/airbrake"
|
||||||
"github.com/Sirupsen/logrus/hooks/syslog"
|
"github.com/Sirupsen/logrus/hooks/syslog"
|
||||||
|
"log/syslog"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
log.AddHook(new(logrus_airbrake.AirbrakeHook))
|
log.AddHook(new(logrus_airbrake.AirbrakeHook))
|
||||||
log.AddHook(logrus_syslog.NewSyslogHook("udp", "localhost:514", syslog.LOG_INFO, ""))
|
|
||||||
|
hook, err := logrus_syslog.NewSyslogHook("udp", "localhost:514", syslog.LOG_INFO, "")
|
||||||
|
if err != nil {
|
||||||
|
log.Error("Unable to connect to local syslog daemon")
|
||||||
|
} else {
|
||||||
|
log.AddHook(hook)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,11 @@ func SetLevel(level Level) {
|
||||||
std.Level = level
|
std.Level = level
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetLevel returns the standard logger level.
|
||||||
|
func GetLevel() Level {
|
||||||
|
return std.Level
|
||||||
|
}
|
||||||
|
|
||||||
// AddHook adds a hook to the standard logger hooks.
|
// AddHook adds a hook to the standard logger hooks.
|
||||||
func AddHook(hook Hook) {
|
func AddHook(hook Hook) {
|
||||||
std.mu.Lock()
|
std.mu.Lock()
|
||||||
|
|
|
@ -29,18 +29,18 @@ func (hook *SyslogHook) Fire(entry *logrus.Entry) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
switch entry.Data["level"] {
|
switch entry.Level {
|
||||||
case "panic":
|
case logrus.PanicLevel:
|
||||||
return hook.Writer.Crit(line)
|
return hook.Writer.Crit(line)
|
||||||
case "fatal":
|
case logrus.FatalLevel:
|
||||||
return hook.Writer.Crit(line)
|
return hook.Writer.Crit(line)
|
||||||
case "error":
|
case logrus.ErrorLevel:
|
||||||
return hook.Writer.Err(line)
|
return hook.Writer.Err(line)
|
||||||
case "warn":
|
case logrus.WarnLevel:
|
||||||
return hook.Writer.Warning(line)
|
return hook.Writer.Warning(line)
|
||||||
case "info":
|
case logrus.InfoLevel:
|
||||||
return hook.Writer.Info(line)
|
return hook.Writer.Info(line)
|
||||||
case "debug":
|
case logrus.DebugLevel:
|
||||||
return hook.Writer.Debug(line)
|
return hook.Writer.Debug(line)
|
||||||
default:
|
default:
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue