添加日志打印

This commit is contained in:
陈景阳
2019-10-10 19:56:04 +08:00
parent 7fe2c9a425
commit 46d89c8cce
4 changed files with 19 additions and 8 deletions

View File

@@ -3,6 +3,7 @@ package msg_handler
import (
"crawlab/constants"
"crawlab/entity"
"github.com/apex/log"
)
type Handler interface {
@@ -10,6 +11,7 @@ type Handler interface {
}
func GetMsgHandler(msg entity.NodeMessage) Handler {
log.Infof("received msg , type is : %s", msg.Type)
if msg.Type == constants.MsgTypeGetLog || msg.Type == constants.MsgTypeRemoveLog {
// 日志相关
return &Log{

View File

@@ -40,8 +40,11 @@ func (g *Log) get() error {
}
// 发布消息给主节点
if err := utils.Pub(constants.ChannelMasterNode, msgSd); err != nil {
log.Errorf("pub log to master node error: %s", err.Error())
debug.PrintStack()
return err
}
log.Infof(msgSd.Log)
return nil
}