mirror of
https://github.com/ehang-io/nps.git
synced 2025-09-02 03:16:53 +00:00
add logs and version for sdk
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
Reference in New Issue
Block a user