增加服务启动与停止日志

This commit is contained in:
duanhf2012
2020-04-01 17:31:35 +08:00
parent 946408ca12
commit c1d6d44fbb
3 changed files with 16 additions and 5 deletions

View File

@@ -7,7 +7,6 @@ import (
"github.com/duanhf2012/origin/log"
"github.com/duanhf2012/origin/service"
"io/ioutil"
syslog "log"
"os"
"os/signal"
"strconv"
@@ -85,7 +84,6 @@ func initNode(id int){
}
func Start() {
SetSysLog("debug","./",syslog.Lshortfile|syslog.LstdFlags)
console.RegisterCommand("start",startNode)
console.RegisterCommand("stop",stopNode)
err := console.Run(os.Args)
@@ -107,6 +105,7 @@ func stopNode(arg interface{}) error {
}
func startNode(paramNodeId interface{}) error {
log.Release("Start running server.")
initNode(paramNodeId.(int))
cluster.GetCluster().Start()
service.Start()
@@ -123,6 +122,8 @@ func startNode(paramNodeId interface{}) error {
close(closeSig)
service.WaitStop()
log.Debug("Server is stop.")
return nil
}