Commit aff9472e authored by mercury233's avatar mercury233

update stderr log

parent d024444c
...@@ -417,7 +417,10 @@ class Room ...@@ -417,7 +417,10 @@ class Room
return return
return return
@process.stderr.on 'data', (data)=> @process.stderr.on 'data', (data)=>
log.info "YGOPRO stderr: " + data data = "Debug: " + data
data = data.replace(/\n$/, "")
log.info "YGOPRO " + data
ygopro.stoc_send_chat_to_room this, data, ygopro.constants.COLORS.RED
@has_ygopro_error = true @has_ygopro_error = true
return return
catch catch
...@@ -426,6 +429,8 @@ class Room ...@@ -426,6 +429,8 @@ class Room
return if @deleted return if @deleted
#log.info 'room-delete', this.name, ROOM_all.length #log.info 'room-delete', this.name, ROOM_all.length
if @player_datas.length and settings.modules.enable_cloud_replay if @player_datas.length and settings.modules.enable_cloud_replay
if @has_ygopro_error
log_rep_id = true
player_names=@player_datas[0].name + (if @player_datas[2] then "+" + @player_datas[2].name else "") + player_names=@player_datas[0].name + (if @player_datas[2] then "+" + @player_datas[2].name else "") +
" VS " + " VS " +
(if @player_datas[1] then @player_datas[1].name else "AI") + (if @player_datas[1] then @player_datas[1].name else "AI") +
...@@ -452,7 +457,7 @@ class Room ...@@ -452,7 +457,7 @@ class Room
recorded_ip.push player_ip recorded_ip.push player_ip
redisdb.lpush(player_ip+":replays", replay_id) redisdb.lpush(player_ip+":replays", replay_id)
return return
if @has_ygopro_error if log_rep_id
log.info "error replay: R#" + replay_id log.info "error replay: R#" + replay_id
return return
@watcher_buffers = [] @watcher_buffers = []
...@@ -738,7 +743,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)-> ...@@ -738,7 +743,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
_.each result, (replay_id,id)-> _.each result, (replay_id,id)->
redisdb.hgetall "replay:"+replay_id, (err, replay)-> redisdb.hgetall "replay:"+replay_id, (err, replay)->
if err or !replay if err or !replay
log.info "cloud replay getall error: " + err log.info "cloud replay getall error: " + err if err
return return
ygopro.stoc_send_chat(client,"<#{id-0+1}> R##{replay_id} #{replay.player_names} #{replay.date_time}", ygopro.constants.COLORS.BABYBLUE) ygopro.stoc_send_chat(client,"<#{id-0+1}> R##{replay_id} #{replay.player_names} #{replay.date_time}", ygopro.constants.COLORS.BABYBLUE)
return return
...@@ -758,7 +763,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)-> ...@@ -758,7 +763,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
if (replay_id>0 and replay_id<=9) if (replay_id>0 and replay_id<=9)
redisdb.lindex client.remoteAddress+":replays", replay_id-1, (err, replay_id)-> redisdb.lindex client.remoteAddress+":replays", replay_id-1, (err, replay_id)->
if err or !replay_id if err or !replay_id
log.info "cloud replay replayid error: " + err log.info "cloud replay replayid error: " + err if err
ygopro.stoc_die(client, "没有找到录像") ygopro.stoc_die(client, "没有找到录像")
return return
redisdb.hgetall "replay:"+replay_id, client.open_cloud_replay redisdb.hgetall "replay:"+replay_id, client.open_cloud_replay
......
...@@ -558,7 +558,10 @@ ...@@ -558,7 +558,10 @@
})(this)); })(this));
this.process.stderr.on('data', (function(_this) { this.process.stderr.on('data', (function(_this) {
return function(data) { return function(data) {
log.info("YGOPRO stderr: " + data); data = "Debug: " + data;
data = data.replace(/\n$/, "");
log.info("YGOPRO " + data);
ygopro.stoc_send_chat_to_room(_this, data, ygopro.constants.COLORS.RED);
_this.has_ygopro_error = true; _this.has_ygopro_error = true;
}; };
})(this)); })(this));
...@@ -568,11 +571,14 @@ ...@@ -568,11 +571,14 @@
} }
Room.prototype["delete"] = function() { Room.prototype["delete"] = function() {
var index, player_ips, player_names, recorder_buffer; var index, log_rep_id, player_ips, player_names, recorder_buffer;
if (this.deleted) { if (this.deleted) {
return; return;
} }
if (this.player_datas.length && settings.modules.enable_cloud_replay) { if (this.player_datas.length && settings.modules.enable_cloud_replay) {
if (this.has_ygopro_error) {
log_rep_id = true;
}
player_names = this.player_datas[0].name + (this.player_datas[2] ? "+" + this.player_datas[2].name : "") + " VS " + (this.player_datas[1] ? this.player_datas[1].name : "AI") + (this.player_datas[3] ? "+" + this.player_datas[3].name : ""); player_names = this.player_datas[0].name + (this.player_datas[2] ? "+" + this.player_datas[2].name : "") + " VS " + (this.player_datas[1] ? this.player_datas[1].name : "AI") + (this.player_datas[3] ? "+" + this.player_datas[3].name : "");
player_ips = []; player_ips = [];
_.each(this.player_datas, function(player) { _.each(this.player_datas, function(player) {
...@@ -594,7 +600,7 @@ ...@@ -594,7 +600,7 @@
recorded_ip.push(player_ip); recorded_ip.push(player_ip);
redisdb.lpush(player_ip + ":replays", replay_id); redisdb.lpush(player_ip + ":replays", replay_id);
}); });
if (this.has_ygopro_error) { if (log_rep_id) {
log.info("error replay: R#" + replay_id); log.info("error replay: R#" + replay_id);
} }
}); });
...@@ -928,7 +934,9 @@ ...@@ -928,7 +934,9 @@
_.each(result, function(replay_id, id) { _.each(result, function(replay_id, id) {
redisdb.hgetall("replay:" + replay_id, function(err, replay) { redisdb.hgetall("replay:" + replay_id, function(err, replay) {
if (err || !replay) { if (err || !replay) {
log.info("cloud replay getall error: " + err); if (err) {
log.info("cloud replay getall error: " + err);
}
return; return;
} }
ygopro.stoc_send_chat(client, "<" + (id - 0 + 1) + "> R#" + replay_id + " " + replay.player_names + " " + replay.date_time, ygopro.constants.COLORS.BABYBLUE); ygopro.stoc_send_chat(client, "<" + (id - 0 + 1) + "> R#" + replay_id + " " + replay.player_names + " " + replay.date_time, ygopro.constants.COLORS.BABYBLUE);
...@@ -947,7 +955,9 @@ ...@@ -947,7 +955,9 @@
if (replay_id > 0 && replay_id <= 9) { if (replay_id > 0 && replay_id <= 9) {
redisdb.lindex(client.remoteAddress + ":replays", replay_id - 1, function(err, replay_id) { redisdb.lindex(client.remoteAddress + ":replays", replay_id - 1, function(err, replay_id) {
if (err || !replay_id) { if (err || !replay_id) {
log.info("cloud replay replayid error: " + err); if (err) {
log.info("cloud replay replayid error: " + err);
}
ygopro.stoc_die(client, "没有找到录像"); ygopro.stoc_die(client, "没有找到录像");
return; return;
} }
......
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