Browse Source

update logger package for new level 'notice'

pull/116/head
Ethan Buchman 9 years ago
parent
commit
e087284a4f
7 changed files with 26 additions and 6 deletions
  1. +2
    -2
      Godeps/Godeps.json
  2. +3
    -1
      Godeps/_workspace/src/github.com/tendermint/log15/format.go
  3. +10
    -0
      Godeps/_workspace/src/github.com/tendermint/log15/logger.go
  4. +5
    -0
      Godeps/_workspace/src/github.com/tendermint/log15/root.go
  5. +2
    -0
      Godeps/_workspace/src/github.com/tendermint/log15/syslog.go
  6. +2
    -1
      node/node.go
  7. +2
    -2
      p2p/switch.go

+ 2
- 2
Godeps/Godeps.json View File

@ -72,8 +72,8 @@
},
{
"ImportPath": "github.com/tendermint/log15",
"Comment": "v2.3-33-g105a1be",
"Rev": "105a1beefe3379227a0d61733a29fd2c34f7080c"
"Comment": "v2.3-34-gbec7415",
"Rev": "bec7415fb62f05ac62298c2bc1a080d45ac3065c"
},
{
"ImportPath": "golang.org/x/crypto/curve25519",


+ 3
- 1
Godeps/_workspace/src/github.com/tendermint/log15/format.go View File

@ -52,8 +52,10 @@ func TerminalFormat() Format {
color = 31
case LvlWarn:
color = 33
case LvlInfo:
case LvlNotice:
color = 32
case LvlInfo:
color = 34
case LvlDebug:
color = 36
}


+ 10
- 0
Godeps/_workspace/src/github.com/tendermint/log15/logger.go View File

@ -17,6 +17,7 @@ const (
LvlCrit Lvl = iota
LvlError
LvlWarn
LvlNotice
LvlInfo
LvlDebug
)
@ -28,6 +29,8 @@ func (l Lvl) String() string {
return "dbug"
case LvlInfo:
return "info"
case LvlNotice:
return "notice"
case LvlWarn:
return "warn"
case LvlError:
@ -47,6 +50,8 @@ func LvlFromString(lvlString string) (Lvl, error) {
return LvlDebug, nil
case "info":
return LvlInfo, nil
case "notice":
return LvlNotice, nil
case "warn":
return LvlWarn, nil
case "error", "eror":
@ -85,6 +90,7 @@ type Logger interface {
// Log a message at the given level with context key/value pairs
Debug(msg string, ctx ...interface{})
Info(msg string, ctx ...interface{})
Notice(msg string, ctx ...interface{})
Warn(msg string, ctx ...interface{})
Error(msg string, ctx ...interface{})
Crit(msg string, ctx ...interface{})
@ -133,6 +139,10 @@ func (l *logger) Info(msg string, ctx ...interface{}) {
l.write(msg, LvlInfo, ctx)
}
func (l *logger) Notice(msg string, ctx ...interface{}) {
l.write(msg, LvlNotice, ctx)
}
func (l *logger) Warn(msg string, ctx ...interface{}) {
l.write(msg, LvlWarn, ctx)
}


+ 5
- 0
Godeps/_workspace/src/github.com/tendermint/log15/root.go View File

@ -51,6 +51,11 @@ func Info(msg string, ctx ...interface{}) {
root.write(msg, LvlInfo, ctx)
}
// Notice is a convenient alias for Root().Notice
func Notice(msg string, ctx ...interface{}) {
root.write(msg, LvlNotice, ctx)
}
// Warn is a convenient alias for Root().Warn
func Warn(msg string, ctx ...interface{}) {
root.write(msg, LvlWarn, ctx)


+ 2
- 0
Godeps/_workspace/src/github.com/tendermint/log15/syslog.go View File

@ -34,6 +34,8 @@ func sharedSyslog(fmtr Format, sysWr *syslog.Writer, err error) (Handler, error)
syslogFn = sysWr.Err
case LvlWarn:
syslogFn = sysWr.Warning
case LvlNotice:
syslogFn = sysWr.Notice
case LvlInfo:
syslogFn = sysWr.Info
case LvlDebug:


+ 2
- 1
node/node.go View File

@ -147,7 +147,6 @@ func NewNode() *Node {
// Call Start() after adding the listeners.
func (n *Node) Start() {
log.Info("Starting Node", "chainID", config.GetString("chain_id"))
n.book.Start()
n.sw.SetNodeInfo(makeNodeInfo(n.sw, n.privKey))
n.sw.SetNodePrivKey(n.privKey)
@ -291,6 +290,8 @@ func RunNode() {
n.AddListener(l)
n.Start()
log.Notice("Started node", "nodeInfo", n.sw.NodeInfo())
// If seedNode is provided by config, dial out.
if config.GetString("seeds") != "" {
n.DialSeed()


+ 2
- 2
p2p/switch.go View File

@ -338,7 +338,7 @@ func (sw *Switch) listenerRoutine(l Listener) {
// ignore connection if we already have enough
if maxNumPeers <= sw.peers.Size() {
log.Debug("Ignoring inbound connection: already have enough peers", "conn", inConn, "numPeers", sw.peers.Size(), "max", maxNumPeers)
log.Debug("Ignoring inbound connection: already have enough peers", "address", inConn.RemoteAddr().String(), "numPeers", sw.peers.Size(), "max", maxNumPeers)
continue
}
@ -351,7 +351,7 @@ func (sw *Switch) listenerRoutine(l Listener) {
// New inbound connection!
_, err := sw.AddPeerWithConnection(inConn, false)
if err != nil {
log.Info("Ignoring inbound connection: error on AddPeerWithConnection", "conn", inConn, "error", err)
log.Info("Ignoring inbound connection: error on AddPeerWithConnection", "address", inConn.RemoteAddr().String(), "error", err)
continue
}


Loading…
Cancel
Save