Browse Source

Service log prettify

pull/117/head
Jae Kwon 10 years ago
parent
commit
c0a64d74be
4 changed files with 16 additions and 5 deletions
  1. +2
    -2
      Godeps/_workspace/src/github.com/tendermint/log15/logger.go
  2. +7
    -0
      common/service.go
  3. +4
    -0
      consensus/state.go
  4. +3
    -3
      p2p/switch_test.go

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

@ -30,7 +30,7 @@ func (l Lvl) String() string {
case LvlInfo:
return "info"
case LvlNotice:
return "notice"
return "note"
case LvlWarn:
return "warn"
case LvlError:
@ -50,7 +50,7 @@ func LvlFromString(lvlString string) (Lvl, error) {
return LvlDebug, nil
case "info":
return LvlInfo, nil
case "notice":
case "note":
return LvlNotice, nil
case "warn":
return LvlWarn, nil


+ 7
- 0
common/service.go View File

@ -49,6 +49,8 @@ type Service interface {
AfterStop()
IsRunning() bool
String() string
}
type BaseService struct {
@ -117,6 +119,11 @@ func (bs *BaseService) IsRunning() bool {
return atomic.LoadUint32(&bs.started) == 1 && atomic.LoadUint32(&bs.stopped) == 0
}
// Implements Servce
func (bs *BaseService) String() string {
return bs.name
}
//----------------------------------------
type QuitService struct {


+ 4
- 0
consensus/state.go View File

@ -1227,3 +1227,7 @@ func (cs *ConsensusState) saveBlock(block *types.Block, blockParts *types.PartSe
func (cs *ConsensusState) SetFireable(evsw events.Fireable) {
cs.evsw = evsw
}
func (cs *ConsensusState) String() string {
return Fmt("ConsensusState(H:%v R:%v S:%v", cs.Height, cs.Round, cs.Step)
}

+ 3
- 3
p2p/switch_test.go View File

@ -92,7 +92,7 @@ func makeSwitchPair(t testing.TB, initSwitch func(*Switch) *Switch) (*Switch, *S
})
s2.SetNodePrivKey(s2PrivKey)
// Start switches
// Start switches and reactors
s1.Start()
s2.Start()
@ -130,11 +130,11 @@ func TestSwitches(t *testing.T) {
sw.AddReactor("foo", NewTestReactor([]*ChannelDescriptor{
&ChannelDescriptor{Id: byte(0x00), Priority: 10},
&ChannelDescriptor{Id: byte(0x01), Priority: 10},
}, true)).Start() // Start the reactor
}, true))
sw.AddReactor("bar", NewTestReactor([]*ChannelDescriptor{
&ChannelDescriptor{Id: byte(0x02), Priority: 10},
&ChannelDescriptor{Id: byte(0x03), Priority: 10},
}, true)).Start() // Start the reactor
}, true))
return sw
})
defer s1.Stop()


Loading…
Cancel
Save