add logs and version for sdk

This commit is contained in:
刘河
2019-12-08 00:29:00 +08:00
parent dfeaf523ee
commit 9993ce8131
3 changed files with 67 additions and 6 deletions

View File

@@ -1,16 +1,14 @@
package main
import "C"
import (
"C"
"github.com/astaxie/beego/logs"
"github.com/cnlh/nps/client"
"github.com/cnlh/nps/lib/common"
"github.com/cnlh/nps/lib/version"
"time"
)
func init() {
logs.SetLogger(logs.AdapterFile, `{"filename":"npc.log","daily":false,"maxlines":100000,"color":true}`)
}
var status int
var closeBefore int
var cl *client.TRPClient
@@ -48,6 +46,16 @@ func CloseClient() {
cl.Close()
}
//export Version
func Version() *C.char {
return C.CString(version.VERSION)
}
func Logs() *C.char {
return C.CString(common.GetLogMsg())
}
func main() {
// Need a main function to make CGO compile package as C shared library
logs.SetLogger("store")
}