1
This commit is contained in:
parent
924d5ca12a
commit
2a32689357
@ -18,15 +18,16 @@ func (this *HttpServer) Init() *HttpServer {
|
||||
this.RegisterHandle("Ops", "selfChecking", func (w http.ResponseWriter,r *http.Request) {
|
||||
w.Write([]byte(`{"errcode":0, "errmsg":"", "health":1, "max_rundelay": 10}`))
|
||||
})
|
||||
fmt.Println("HttpServer.Init\n")
|
||||
SysLog().Info("HttpServer.Init")
|
||||
return this
|
||||
}
|
||||
|
||||
func (this *HttpServer) UnInit() {
|
||||
fmt.Println("HttpServer.UnInit\n")
|
||||
SysLog().Info("HttpServer.UnInit")
|
||||
}
|
||||
|
||||
func (this *HttpServer) Start(listen_port int32) {
|
||||
SysLog().Info("HttpServer.Start listen_port:%d", listen_port)
|
||||
go http.ListenAndServe(fmt.Sprintf("0.0.0.0:%d", listen_port), nil)
|
||||
}
|
||||
|
||||
|
15
syslog.go
15
syslog.go
@ -1,10 +1,12 @@
|
||||
package f5
|
||||
|
||||
import "os"
|
||||
import "sync"
|
||||
import "time"
|
||||
import "fmt"
|
||||
import "q5"
|
||||
import (
|
||||
"os"
|
||||
"sync"
|
||||
"time"
|
||||
"fmt"
|
||||
"q5"
|
||||
)
|
||||
|
||||
const (
|
||||
LOG_DEBUG = 0
|
||||
@ -26,7 +28,6 @@ type LogMsgNode struct {
|
||||
|
||||
type SysLog_ struct {
|
||||
logLevel int32
|
||||
debuging bool
|
||||
topNode *LogMsgNode
|
||||
botNode *LogMsgNode
|
||||
msgMutex sync.Mutex
|
||||
@ -96,7 +97,7 @@ func (this *SysLog_) addLog(category string, format string, args ...interface{})
|
||||
p.logMsg = time.Now().Format("2006-01-02 15:04:05") +
|
||||
category + " " +
|
||||
fmt.Sprintf(format, args...) + "\n"
|
||||
if this.debuging {
|
||||
if q5.Debug() {
|
||||
fmt.Print(p.logMsg)
|
||||
}
|
||||
this.msgMutex.Lock()
|
||||
|
Loading…
x
Reference in New Issue
Block a user