Commit a4ce4402 authored by AlexStocks's avatar AlexStocks

delete gocolor, use gxlog instead

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