Commit a4ce4402 authored by AlexStocks's avatar AlexStocks

delete gocolor, use gxlog instead

parent 066a35c5
......@@ -17,7 +17,6 @@ import (
)
import (
// "github.com/AlexStocks/gocolor"
log "github.com/AlexStocks/log4go"
config "github.com/koding/multiconfig"
)
......@@ -139,7 +138,7 @@ func initConf() {
panic(fmt.Sprintf("time.ParseDuration(WaitTimeout{%#v}) = error{%v}", conf.GettySessionParam.WaitTimeout, err))
return
}
// gocolor.Info("config{%#v}\n", conf)
// gxlog.Info("config{%#v}\n", conf)
// log
confFile = os.Getenv(APP_LOG_CONF_FILE)
......
......@@ -25,7 +25,7 @@ import (
import (
"github.com/AlexStocks/getty"
"github.com/AlexStocks/gocolor"
"github.com/AlexStocks/goext/log"
"github.com/AlexStocks/goext/net"
"github.com/AlexStocks/goext/time"
log "github.com/AlexStocks/log4go"
......@@ -49,7 +49,7 @@ func main() {
initProfiling()
initClient()
gocolor.Info("%s starts successfull! its version=%s\n", conf.AppName, Version)
gxlog.CInfo("%s starts successfull! its version=%s\n", conf.AppName, Version)
log.Info("%s starts successfull! its version=%s\n", conf.AppName, Version)
go test()
......@@ -182,5 +182,5 @@ func test() {
}
cost = counter.Count()
log.Info("after loop %d times, echo cost %d ms", conf.EchoTimes, cost/1e6)
gocolor.Info("after loop %d times, echo cost %d ms", conf.EchoTimes, cost/1e6)
gxlog.CInfo("after loop %d times, echo cost %d ms", conf.EchoTimes, cost/1e6)
}
......@@ -17,7 +17,6 @@ import (
)
import (
// "github.com/AlexStocks/gocolor"
log "github.com/AlexStocks/log4go"
config "github.com/koding/multiconfig"
)
......@@ -114,7 +113,7 @@ func initConf() {
panic(fmt.Sprintf("time.ParseDuration(WaitTimeout{%#v}) = error{%v}", conf.GettySessionParam.WaitTimeout, err))
return
}
// gocolor.Info("config{%#v}\n", conf)
// gxlog.CInfo("config{%#v}\n", conf)
// log
confFile = os.Getenv(APP_LOG_CONF_FILE)
......
......@@ -24,7 +24,7 @@ import (
import (
"github.com/AlexStocks/getty"
"github.com/AlexStocks/gocolor"
"github.com/AlexStocks/goext/log"
"github.com/AlexStocks/goext/net"
log "github.com/AlexStocks/log4go"
)
......@@ -53,7 +53,7 @@ func main() {
initProfiling()
initServer()
gocolor.Info("%s starts successfull! its version=%s, its listen ends=%s:%s\n",
gxlog.CInfo("%s starts successfull! its version=%s, its listen ends=%s:%s\n",
conf.AppName, Version, conf.Host, conf.Ports)
log.Info("%s starts successfull! its version=%s, its listen ends=%s:%s\n",
conf.AppName, Version, conf.Host, conf.Ports)
......
......@@ -17,7 +17,7 @@ import (
)
import (
// "github.com/AlexStocks/gocolor"
// "github.com/AlexStocks/goext/log"
log "github.com/AlexStocks/log4go"
config "github.com/koding/multiconfig"
)
......@@ -140,7 +140,7 @@ func initConf() {
panic(fmt.Sprintf("time.ParseDuration(WaitTimeout{%#v}) = error{%v}", conf.GettySessionParam.WaitTimeout, err))
return
}
// gocolor.Info("config{%#v}\n", conf)
// gxlog.CInfo("config{%#v}\n", conf)
// log
confFile = os.Getenv(APP_LOG_CONF_FILE)
......
......@@ -26,7 +26,7 @@ import (
import (
"github.com/AlexStocks/getty"
"github.com/AlexStocks/gocolor"
"github.com/AlexStocks/goext/log"
"github.com/AlexStocks/goext/net"
"github.com/AlexStocks/goext/time"
log "github.com/AlexStocks/log4go"
......@@ -50,7 +50,7 @@ func main() {
initProfiling()
initClient()
gocolor.Info("%s starts successfull! its version=%s\n", conf.AppName, Version)
gxlog.CInfo("%s starts successfull! its version=%s\n", conf.AppName, Version)
log.Info("%s starts successfull! its version=%s\n", conf.AppName, Version)
go test()
......@@ -191,5 +191,5 @@ func test() {
}
cost = counter.Count()
log.Info("after loop %d times, echo cost %d ms", conf.EchoTimes, cost/1e6)
gocolor.Info("after loop %d times, echo cost %d ms", conf.EchoTimes, cost/1e6)
gxlog.CInfo("after loop %d times, echo cost %d ms", conf.EchoTimes, cost/1e6)
}
......@@ -40,7 +40,7 @@ $(function() {
var $chatPage = $('.chat.page'); // The chatroom page
// var socket = new WebSocket('ws://192.168.35.1:10000/echo');
var socket = new WebSocket('ws://' + serverAddress + '/echo')
var socket = new WebSocket('ws://' + serverAddress + '/echo');
// // Setting binaryType to accept received binary as either 'blob' or 'arraybuffer'. In default it is 'blob'.
// socket.binaryType = 'arraybuffer';
// socket.binaryType = ''
......@@ -61,7 +61,7 @@ $(function() {
var tmp = new Uint8Array(header.byteLength + 1 + msg.length);
tmp.set(new Uint8Array(header), 0);
tmp[header.byteLength] = msg.length
tmp[header.byteLength] = msg.length;
var ma = new TextEncoder("utf-8").encode(msg);
tmp.set(ma, header.byteLength + 1);
......@@ -136,12 +136,12 @@ $(function() {
addMessageElement($el, options);
}
var imgReg = /:img\s+(\S+)/
var imgReg = /:img\s+(\S+)/;
// Adds the visual chat message to the message list
function addChatMessage (data, options) {
// Don't fade the message in if there is an 'X was typing'
options = options || {};
var regRes = imgReg.exec(data.Message)
var regRes = imgReg.exec(data.Message);
if (regRes != null) {
var $messageBodyDiv = $('<img src="' + regRes[1] + '">');
} else {
......@@ -209,7 +209,7 @@ $(function() {
socket.onopen = function() {
console.log('websocket extensions:' + socket.extensions);
}
};
// Socket events
socket.onmessage = function(e) {
// e.data is blob
......@@ -220,15 +220,15 @@ $(function() {
unmarshalEchoPkg(dv.buffer)
};
fileReader.readAsArrayBuffer(e.data); // 此处读取blob
}
};
socket.onclose = function(e) {
// console.log("socket.onclose" + e.reason)
disconnect()
disconnect();
addChatMessage({
Message: e.reason + '!!SYSTEM-WS-Close, connection closed'
});
}
};
socket.onerror = function() {
addChatMessage({
......
......@@ -17,7 +17,7 @@ import (
)
import (
// "github.com/AlexStocks/gocolor"
// "github.com/AlexStocks/goext/log"
log "github.com/AlexStocks/log4go"
config "github.com/koding/multiconfig"
)
......@@ -126,7 +126,7 @@ func initConf() {
panic(fmt.Sprintf("time.ParseDuration(WaitTimeout{%#v}) = error{%v}", conf.GettySessionParam.WaitTimeout, err))
return
}
// gocolor.Info("config{%#v}\n", conf)
// gxlog.CInfo("config{%#v}\n", conf)
// log
confFile = os.Getenv(APP_LOG_CONF_FILE)
......
......@@ -25,7 +25,7 @@ import (
import (
"github.com/AlexStocks/getty"
"github.com/AlexStocks/gocolor"
"github.com/AlexStocks/goext/log"
"github.com/AlexStocks/goext/net"
log "github.com/AlexStocks/log4go"
)
......@@ -54,7 +54,7 @@ func main() {
initProfiling()
initServer()
gocolor.Info("%s starts successfull! its version=%s, its listen ends=%s:%s:%s\n",
gxlog.CInfo("%s starts successfull! its version=%s, its listen ends=%s:%s:%s\n",
conf.AppName, Version, conf.Host, conf.Ports, conf.Paths)
log.Info("%s starts successfull! its version=%s, its listen ends=%s:%s:%s\n",
conf.AppName, Version, conf.Host, conf.Ports, conf.Paths)
......
......@@ -17,7 +17,7 @@ import (
)
import (
// "github.com/AlexStocks/gocolor"
// "github.com/AlexStocks/goext/log"
log "github.com/AlexStocks/log4go"
config "github.com/koding/multiconfig"
)
......@@ -144,7 +144,7 @@ func initConf() {
panic(fmt.Sprintf("time.ParseDuration(WaitTimeout{%#v}) = error{%v}", conf.GettySessionParam.WaitTimeout, err))
return
}
// gocolor.Info("config{%#v}\n", conf)
// gxlog.CInfo("config{%#v}\n", conf)
// log
confFile = os.Getenv(APP_LOG_CONF_FILE)
......
......@@ -26,7 +26,7 @@ import (
import (
"github.com/AlexStocks/getty"
"github.com/AlexStocks/gocolor"
"github.com/AlexStocks/goext/log"
"github.com/AlexStocks/goext/net"
"github.com/AlexStocks/goext/time"
log "github.com/AlexStocks/log4go"
......@@ -50,7 +50,7 @@ func main() {
initProfiling()
initClient()
gocolor.Info("%s starts successfull! its version=%s\n", conf.AppName, Version)
gxlog.CInfo("%s starts successfull! its version=%s\n", conf.AppName, Version)
log.Info("%s starts successfull! its version=%s\n", conf.AppName, Version)
go test()
......@@ -200,5 +200,5 @@ func test() {
}
cost = counter.Count()
log.Info("after loop %d times, echo cost %d ms", conf.EchoTimes, cost/1e6)
gocolor.Info("after loop %d times, echo cost %d ms", conf.EchoTimes, cost/1e6)
gxlog.CInfo("after loop %d times, echo cost %d ms", conf.EchoTimes, cost/1e6)
}
......@@ -48,7 +48,7 @@ $(function() {
// http://stackoverflow.com/questions/7580508/getting-chrome-to-accept-self-signed-localhost-certificate#comment33762412_15076602
// chrome://flags/#allow-insecure-localhost
var socket = new WebSocket('wss://' + serverAddress + '/echo')
var socket = new WebSocket('wss://' + serverAddress + '/echo');
// // Setting binaryType to accept received binary as either 'blob' or 'arraybuffer'. In default it is 'blob'.
// socket.binaryType = 'arraybuffer';
// socket.binaryType = ''
......@@ -69,7 +69,7 @@ $(function() {
var tmp = new Uint8Array(header.byteLength + 1 + msg.length);
tmp.set(new Uint8Array(header), 0);
tmp[header.byteLength] = msg.length
tmp[header.byteLength] = msg.length;
var ma = new TextEncoder("utf-8").encode(msg);
tmp.set(ma, header.byteLength + 1);
......@@ -144,12 +144,12 @@ $(function() {
addMessageElement($el, options);
}
var imgReg = /:img\s+(\S+)/
var imgReg = /:img\s+(\S+)/;
// Adds the visual chat message to the message list
function addChatMessage (data, options) {
// Don't fade the message in if there is an 'X was typing'
options = options || {};
var regRes = imgReg.exec(data.Message)
var regRes = imgReg.exec(data.Message);
if (regRes != null) {
var $messageBodyDiv = $('<img src="' + regRes[1] + '">');
} else {
......@@ -217,7 +217,7 @@ $(function() {
socket.onopen = function() {
console.log('websocket extensions:' + socket.extensions);
}
};
// Socket events
socket.onmessage = function(e) {
// e.data is blob
......@@ -228,15 +228,15 @@ $(function() {
unmarshalEchoPkg(dv.buffer)
};
fileReader.readAsArrayBuffer(e.data); // 此处读取blob
}
};
socket.onclose = function(e) {
// console.log("socket.onclose" + e.reason)
disconnect()
disconnect();
addChatMessage({
Message: e.reason + '!!SYSTEM-WS-Close, connection closed'
});
}
};
socket.onerror = function() {
addChatMessage({
......
......@@ -17,7 +17,7 @@ import (
)
import (
// "github.com/AlexStocks/gocolor"
// "github.com/AlexStocks/goext/log"
log "github.com/AlexStocks/log4go"
config "github.com/koding/multiconfig"
)
......@@ -132,7 +132,7 @@ func initConf() {
panic(fmt.Sprintf("time.ParseDuration(WaitTimeout{%#v}) = error{%v}", conf.GettySessionParam.WaitTimeout, err))
return
}
// gocolor.Info("config{%#v}\n", conf)
// gxlog.CInfo("config{%#v}\n", conf)
// log
confFile = os.Getenv(APP_LOG_CONF_FILE)
......
......@@ -25,7 +25,7 @@ import (
import (
"github.com/AlexStocks/getty"
"github.com/AlexStocks/gocolor"
"github.com/AlexStocks/goext/log"
"github.com/AlexStocks/goext/net"
log "github.com/AlexStocks/log4go"
)
......@@ -54,7 +54,7 @@ func main() {
initProfiling()
initServer()
gocolor.Info("%s starts successfull! its version=%s, its listen ends=%s:%s:%s\n",
gxlog.CInfo("%s starts successfull! its version=%s, its listen ends=%s:%s:%s\n",
conf.AppName, Version, conf.Host, conf.Ports, conf.Paths)
log.Info("%s starts successfull! its version=%s, its listen ends=%s:%s:%s\n",
conf.AppName, Version, conf.Host, conf.Ports, conf.Paths)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment