本文整理匯總了Golang中github.com/FactomProject/factomd/common/interfaces.IState.String方法的典型用法代碼示例。如果您正苦於以下問題:Golang IState.String方法的具體用法?Golang IState.String怎麽用?Golang IState.String使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/FactomProject/factomd/common/interfaces.IState
的用法示例。
在下文中一共展示了IState.String方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: PrtMsgs
func (m *MsgLog) PrtMsgs(state interfaces.IState) {
m.sem.Lock()
defer m.sem.Unlock()
if len(m.MsgList) == 0 {
return
}
fmt.Println(state.String())
fmt.Println("\n-----------------------------------------------------")
for _, e := range m.MsgList {
if e.valid {
dirstr := "->"
if !e.out {
dirstr = "<-"
}
fmt.Print(fmt.Sprintf("**** %8s %2s %8s %10s %5v **** %s\n", e.name, dirstr, e.peer, e.where, e.valid, e.msg.String()))
}
}
now := state.GetTimestamp()
m.last = now
m.msgCnt += len(m.MsgList) // Keep my counts
m.msgCntp += len(m.MsgList)
m.MsgList = m.MsgList[0:0] // Once printed, clear the list
fmt.Println(fmt.Sprintf("*** %42s **** ", fmt.Sprintf("Length: %d Msgs/sec: T %d P %d", len(m.MsgList), m.msgPerSec, m.msgPerSecp)))
fmt.Println("\n-----------------------------------------------------")
}
示例2: PrintBusy
func PrintBusy(state interfaces.IState, i int) {
s := state.(*s.State)
if len(s.ShutdownChan) == 0 {
if state.GetOut() {
state.Print(fmt.Sprintf("\r%19s: %s %s",
"Timer",
state.String(),
(string)((([]byte)("-\\|/-\\|/-="))[i])))
}
}
}