Main.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  1. MWF.xApplication.LogViewer.Main = new Class({
  2. Extends: MWF.xApplication.Common.Main,
  3. Implements: [Options, Events],
  4. options: {
  5. "style": "default",
  6. "name": "LogViewer",
  7. "icon": "icon.png",
  8. "width": "800",
  9. "height": "600",
  10. "title": MWF.xApplication.LogViewer.LP.title
  11. },
  12. onQueryLoad: function(){
  13. this.lp = MWF.xApplication.LogViewer.LP;
  14. this.tagId = o2.uuid();
  15. },
  16. loadApplication: function(callback){
  17. if (!this.options.isRefresh){
  18. this.maxSize(function(){
  19. this.doLog();
  20. }.bind(this));
  21. }else{
  22. this.doLog();
  23. }
  24. if (callback) callback();
  25. },
  26. doLog: function(){
  27. this.status = "systemLog";
  28. this.actions = MWF.Actions.get("x_program_center");
  29. this.node = new Element("div", {"styles": this.css.contentNode}).inject(this.content);
  30. this.toolbarNode = new Element("div", {"styles": this.css.toolbarNode}).inject(this.node);
  31. this.screenNode = new Element("div", {"styles": this.css.screenNode}).inject(this.node);
  32. this.bottomNode = new Element("div", {"styles": this.css.bottomNode}).inject(this.node);
  33. this.loadToolbar();
  34. this.loadScreen();
  35. this.loadBottom();
  36. this.initLog();
  37. this.loadLog();
  38. },
  39. initLog: function(appendFlag){
  40. if(!appendFlag){
  41. this.screenInforAreaNode.empty();
  42. }
  43. this.date = this.dateSelect.options[this.dateSelect.selectedIndex];
  44. this.method = "listPromptErrorLog";
  45. this.count = 20;
  46. this.currentId = "(0)";
  47. //定时器
  48. },
  49. loadBottom: function(){
  50. this.nodeSelect = new Element("select", {"styles": this.css.toolbarNodeSelect}).inject(this.bottomNode);
  51. o2.Actions.load("x_program_center").CommandAction.getNodeInfoList(
  52. function( json ){
  53. var nodeList = json.data.nodeList;
  54. nodeList.each(function (node) {
  55. new Element("option", {
  56. "value": node.node.nodeAgentPort,
  57. "text": node.nodeAddress
  58. }).inject(this.nodeSelect);
  59. }.bind(this));
  60. }.bind(this),null, false
  61. );
  62. this.commandNode = new Element("input",{"styles":this.css.commandNode}).inject(this.bottomNode);
  63. this.commandBtnNode = new Element("button",{"text":"submit","styles":this.css.commandBtnNode}).inject(this.bottomNode);
  64. this.commandNode.addEvent('keyup', function(e) {
  65. if(e.key==="enter"){
  66. this.executeCommand();
  67. }
  68. }.bind(this));
  69. this.commandBtnNode.addEvent("click",function () {
  70. this.executeCommand();
  71. }.bind(this));
  72. },
  73. executeCommand : function(){
  74. if(this.commandNode.get("value")!==""){
  75. var data = {};
  76. data["ctl"] = this.commandNode.get("value");
  77. data["nodeName"] = this.nodeSelect.getElement("option:selected").get("text");
  78. data["nodePort"] = this.nodeSelect.getElement("option:selected").get("value");
  79. o2.Actions.load("x_program_center").CommandAction.executeCommand(data, function( json ){
  80. this.commandNode.set("value","");
  81. }.bind(this),null, false);
  82. }
  83. },
  84. loadToolbar: function(){
  85. this.systemLogButton = this.createTopButton("SystemLog", "systemLog.png", "systemLog");
  86. this.promptErrorButton = this.createTopButton("PromptError", "prompt.png", "prompt");
  87. this.unexpectedErrorButton = this.createTopButton("UnexpectedError", "unexpected.png", "unexpected");
  88. this.warnErrorButton = this.createTopButton("Warn", "warn.png", "warn");
  89. this.dateSelect = new Element("select", {"styles": this.css.toolbarDateSelect}).inject(this.toolbarNode);
  90. new Element("option", {
  91. "value": "all",
  92. "selected": true,
  93. "text": this.lp.current
  94. }).inject(this.dateSelect);
  95. var d = new Date();
  96. var t = d.format("%Y-%m-%d");
  97. new Element("option", { "value": t, "text": t }).inject(this.dateSelect);
  98. for (var i=0; i<=7; i++){
  99. d = d.decrement("day", 1);
  100. t = d.format("%Y-%m-%d");
  101. new Element("option", { "value": t, "text": t }).inject(this.dateSelect);
  102. }
  103. this.dateSelect.addEvent("change", function(){
  104. this.initLog();
  105. this.loadLog();
  106. }.bind(this));
  107. // this.promptErrorButton.addEvent("click", function(){
  108. // this.showTypeLog("prompt");
  109. // }.bind(this));
  110. // this.unexpectedErrorButton.addEvent("click", function(){
  111. // this.showTypeLog("unexpected");
  112. // }.bind(this));
  113. // this.warnErrorButton.addEvent("click", function(){
  114. // this.showTypeLog("warn");
  115. // }.bind(this));
  116. this.clearBtn = new Element("button",{"text":"clear","style":"margin:10px;float:right"}).inject(this.toolbarNode);
  117. this.clearBtn.addEvent("click",function () {
  118. this.screenInforAreaNode.empty();
  119. this.tagId = o2.uuid();
  120. }.bind(this));
  121. this.stopBtn = new Element("button",{"text":"stop","style":"margin:10px;float:right"}).inject(this.toolbarNode);
  122. this.startBtn = new Element("button",{"text":"start","style":"margin:10px;display:none;;float:right"}).inject(this.toolbarNode);
  123. this.stopBtn.addEvent("click",function () {
  124. this.startBtn.show();
  125. this.stopBtn.hide();
  126. if(this.method==="listSystemLog"){
  127. $clear(this.timeDo);
  128. this.timeDo = null;
  129. }else {
  130. this.initLog();
  131. this.loadLog();
  132. }
  133. }.bind(this));
  134. this.startBtn.addEvent("click",function () {
  135. this.startBtn.hide();
  136. this.stopBtn.show();
  137. this.initLog(true);
  138. this.loadLog();
  139. }.bind(this));
  140. },
  141. showTypeLog: function(status){
  142. $clear(this.timeDo);
  143. this.timeDo = null;
  144. if (this.status!==status){
  145. switch (this.status){
  146. case "prompt":
  147. this.promptErrorButton.setStyles(this.css.toolbarButton);
  148. break;
  149. case "unexpected":
  150. this.unexpectedErrorButton.setStyles(this.css.toolbarButton);
  151. break;
  152. case "warn":
  153. this.warnErrorButton.setStyles(this.css.toolbarButton);
  154. break;
  155. case "systemLog":
  156. this.systemLogButton.setStyles(this.css.toolbarButton);
  157. break;
  158. }
  159. switch (status){
  160. case "prompt":
  161. this.promptErrorButton.setStyles(this.css.toolbarButton_down);
  162. this.status="prompt";
  163. break;
  164. case "unexpected":
  165. this.unexpectedErrorButton.setStyles(this.css.toolbarButton_down);
  166. this.status="unexpected";
  167. break;
  168. case "warn":
  169. this.warnErrorButton.setStyles(this.css.toolbarButton_down);
  170. this.status="warn";
  171. break;
  172. case "systemLog":
  173. this.systemLogButton.setStyles(this.css.toolbarButton_down);
  174. this.status="systemLog";
  175. break;
  176. default:
  177. this.promptErrorButton.setStyles(this.css.toolbarButton_down);
  178. this.status="prompt";
  179. }
  180. this.initLog();
  181. this.loadLog();
  182. }
  183. },
  184. createTopButton: function(text, img, status){
  185. var node = new Element("div", {"styles": this.css.toolbarButton}).inject(this.toolbarNode);
  186. var iconNode = new Element("div", {"styles": this.css.toolbarIconButton}).inject(node);
  187. var textNode = new Element("div", {"styles": this.css.toolbarTextButton, "text": text}).inject(node);
  188. iconNode.setStyle("background-image", "url("+"../x_component_LogViewer/$Main/default/"+img+")");
  189. if (status==this.status) node.setStyles(this.css.toolbarButton_down);
  190. var _self = this;
  191. node.addEvents({
  192. "mouseover": function(){if (_self.status != status) this.setStyles(_self.css.toolbarButton_over);},
  193. "mousedown": function(){if (_self.status != status) this.setStyles(_self.css.toolbarButton_down);},
  194. "mouseup": function(){if (_self.status != status) this.setStyles(_self.css.toolbarButton_over);},
  195. "mouseout": function(){if (_self.status != status) this.setStyles(_self.css.toolbarButton);},
  196. "click": function(){_self.showTypeLog(status);}.bind(this)
  197. });
  198. return node;
  199. },
  200. loadLog: function(){
  201. this.date = this.dateSelect.options[this.dateSelect.selectedIndex].value;
  202. switch (this.status){
  203. case "prompt":
  204. this.method = (this.date==="all") ? "listPromptErrorLog" : "listPromptErrorLogWithDate";
  205. break;
  206. case "unexpected":
  207. this.method = (this.date==="all") ? "listUnexpectedErrorLog" : "listUnexpectedErrorLogWithDate";
  208. break;
  209. case "warn":
  210. this.method = (this.date==="all") ? "listWarnLog" : "listWarnLogWithDate";
  211. break;
  212. case "systemLog":
  213. this.method = "listSystemLog";
  214. break;
  215. default:
  216. //this.method = (this.date==="all") ? "listPromptErrorLog" : "listPromptErrorLogWithDate";
  217. this.method = "listSystemLog";
  218. }
  219. if(this.method==="listSystemLog"){
  220. this.actions[this.method](this.tagId, function(json){
  221. this.showSystemLog(json.data);
  222. }.bind(this));
  223. //添加定时器
  224. this.timeDo = this.tiemShowSystemLog.periodical(1000,this);
  225. }else{
  226. if (this.date==="all"){
  227. this.actions[this.method](this.currentId, this.count, function(json){
  228. this.showLog(json.data);
  229. }.bind(this));
  230. }else{
  231. var d = new Date().parse(this.date).format("%Y-%m-%d");
  232. this.actions[this.method](this.currentId, this.count, d, function(json){
  233. this.showLog(json.data);
  234. }.bind(this));
  235. }
  236. }
  237. },
  238. showSystemLog : function(data){
  239. this.logFinish = true;
  240. data.each(function (log) {
  241. var node = new Element("div", {"styles": this.css.logItemNode}).inject(this.screenInforAreaNode);
  242. if(log.logLevel){
  243. var lineLog = log.lineLog;
  244. var logTime = log.logTime.split("#")[0];
  245. lineLog = lineLog.replace(logTime,"");
  246. lineLog = lineLog.replace(log.logLevel,"");
  247. var typeNode = new Element("div",{
  248. "html" : log.logLevel,
  249. "title" : log.node,
  250. "style" : "float:left;margin:0 10px;width:50px;font-weight:500;"
  251. }).inject(node);
  252. var color = "#FF0000";
  253. switch (log.logLevel) {
  254. case "INFO" :
  255. color = "#5a86ff";
  256. break;
  257. case "PRINT" :
  258. color = "#ffd192";
  259. break;
  260. case "DEBUG" :
  261. color = "#d7ff3d";
  262. break;
  263. default :
  264. }
  265. typeNode.setStyle("color",color);
  266. var timeNode = new Element("div",{
  267. "html" : logTime,
  268. "style" : "float:left;margin:0 10px;width:180px;color:#6BC5FC"
  269. }).inject(node);
  270. }
  271. var contentNode = new Element("div",{
  272. "text" : log.lineLog,
  273. "style" : "margin-left:270px"
  274. }).inject(node);
  275. }.bind(this));
  276. },
  277. tiemShowSystemLog : function(){
  278. this.actions[this.method](this.tagId, function(json){
  279. this.showSystemLog(json.data);
  280. this.screenInforAreaNode.scrollTop = this.screenInforAreaNode.scrollHeight;
  281. }.bind(this));
  282. },
  283. showLog: function(data){
  284. if (data.length){
  285. var last = data[data.length-1];
  286. this.currentId = last.id;
  287. data.each(function(log){
  288. new MWF.xApplication.LogViewer.Log(log, this);
  289. }.bind(this));
  290. // switch (this.status){
  291. // case "prompt":
  292. // this.showPromptLog(data);
  293. // break;
  294. // case "unexpected":
  295. // this.showUnexpectedLog(data);
  296. // break;
  297. // case "warn":
  298. // this.showWarnLog(data);
  299. // break;
  300. // default:
  301. // this.showPromptLog(data);
  302. // }
  303. }else{
  304. this.logFinish = true;
  305. }
  306. this.checkLoadNext();
  307. },
  308. checkLoadNext: function(){
  309. if (!this.logFinish){
  310. var s = this.screenInforAreaNode.getScroll();
  311. var ssize = this.screenInforAreaNode.getScrollSize();
  312. var size = this.screenInforAreaNode.getSize();
  313. if (ssize.y-s.y-size.y<200){
  314. this.loadLog();
  315. }
  316. }
  317. },
  318. // showPromptLog: function(data){
  319. // data.each(function(log){
  320. // new MWF.xApplication.LogViewer.Log(log, this);
  321. // }.bind(this));
  322. // },
  323. begin: function(){
  324. this.beginButton.setStyle("background-image", "url("+"../x_component_Console/$Main/default/play_gray.png)");
  325. this.stopButton.setStyle("background-image", "url("+"../x_component_Console/$Main/default/stop.png)");
  326. this.status = "begin";
  327. },
  328. stop: function(){
  329. this.beginButton.setStyle("background-image", "url("+"../x_component_Console/$Main/default/play.png)");
  330. this.stopButton.setStyle("background-image", "url("+"../x_component_Console/$Main/default/stop_gray.png)");
  331. this.status = "stop";
  332. },
  333. loadScreen: function(){
  334. this.screenInforAreaNode = new Element("div", {"styles": this.css.screenInforAreaNode}).inject(this.screenNode);
  335. this.screenInforAreaNode.addEvent("scroll", function(){
  336. this.checkLoadNext();
  337. }.bind(this));
  338. //this.screenInforAreaNode = new Element("div", {"styles": this.css.screenInforAreaNode}).inject(this.screenScrollNode);
  339. // MWF.require("MWF.widget.ScrollBar", function(){
  340. // new MWF.widget.ScrollBar(this.screenScrollNode, {
  341. // "style":"xApp_console", "where": "before", "indent": false, "distance": 50, "friction": 6, "axis": {"x": false, "y": true},
  342. // "onScroll": function(y, x){
  343. // // var scrollSize = _self.listScrollAreaNode.getScrollSize();
  344. // // var clientSize = _self.listScrollAreaNode.getSize();
  345. // // var scrollHeight = scrollSize.y-clientSize.y;
  346. // // if (y+200>scrollHeight) {
  347. // // if (!_self.isElementLoaded) _self.listItemNext();
  348. // // }
  349. // }
  350. // });
  351. // }.bind(this));
  352. this.setScreenHeight();
  353. this.addEvent("resize", this.setScreenHeight.bind(this));
  354. },
  355. setScreenHeight: function(){
  356. var size = this.node.getSize();
  357. var toolbarSize = this.toolbarNode.getSize();
  358. var bottomSize = this.bottomNode.getSize();
  359. var y = size.y-toolbarSize.y-bottomSize.y;
  360. this.screenNode.setStyle("height", ""+y+"px");
  361. }
  362. });
  363. MWF.xApplication.LogViewer.Log = new Class({
  364. initialize: function(log, app){
  365. this.log = log;
  366. this.app = app;
  367. this.css = this.app.css;
  368. this.lp = this.app.lp;
  369. this.load();
  370. },
  371. load: function(){
  372. this.node = new Element("div", {"styles": this.css.logItemNode}).inject(this.app.screenInforAreaNode);
  373. if(!this.log) return;
  374. var m = this.log.message.substr(0, this.log.message.indexOf("\n"));
  375. var message = m + ((this.log.person) ? "&nbsp;("+this.log.person+")": "");
  376. var html = "<pre><span class='MWFLogCheckbox' style='cursor: pointer;float: left; height: 20px; width: 30px; background: url(../x_component_LogViewer/$Main/default/check.png) no-repeat center center'></span>" +
  377. "<span style='float: left;font-size: 14px; font-weight: bold; width: 160px; text-align: right'>"+this.log.occurTime+"</span>" +
  378. "<span style='float:left'>\t</span>" +
  379. "<span style='font-size: 14px; font-weight: bold;'>"+o2.common.encodeHtml(message)+"</span><br/>";
  380. if (this.log.exceptionClass){
  381. html += "<span style='float: left; width: 190px; text-align: right; color: #6BC5FC;'>ExceptionClass: </span>" +
  382. "<span style='float:left'>\t</span>" +
  383. "<span>"+o2.common.encodeHtml(this.log.exceptionClass)+"</span><br/>";
  384. }
  385. if (this.log.loggerName){
  386. html += "<span style='float: left; width: 190px; text-align: right; color: #6BC5FC;'>LoggerName: </span>" +
  387. "<span style='float:left'>\t</span>" +
  388. "<span>"+o2.common.encodeHtml(this.log.loggerName)+"</span><br/>";
  389. }
  390. if (this.log.stackTrace){
  391. var traces = this.log.stackTrace.split(/[\r\n\t]/g);
  392. html += "<span class='MWFLogStackTrace'><span style='float: left; width: 190px; text-align: right; color: #6BC5FC;'>StackTrace: </span>" +
  393. "<span style='float:left'>\t</span>";
  394. if (traces.length>1) {
  395. html += "<span class='MWFLogStackTraceAction' style='float: left; cursor: pointer; height: 20px; width: 16px; background: url(../x_component_LogViewer/$Main/default/right.png) no-repeat left center'></span>";
  396. }
  397. html += "<span>"+o2.common.encodeHtml(traces[0])+"</span></span><br/>";
  398. // traces.each(function(trace, i){
  399. // if (i!==0){
  400. // html += "<span style='float: left; width: 190px; text-align: right; color: #6BC5FC;'>&nbsp;</span>" +
  401. // "<span>&nbsp;&nbsp;</span>" +
  402. // "<span>\t"+trace+"</span><br/>";
  403. // }
  404. // }.bind(this));
  405. }
  406. if (this.log.requestUrl){
  407. var request = ((this.log.requestMethod) ? this.log.requestMethod+"&nbsp;": "")+
  408. this.log.requestUrl+
  409. ((this.log.requestRemoteAddr) ? "&nbsp; From &nbsp;"+this.log.requestRemoteAddr : "");
  410. html += "<span class='MWFLogRequest'><span style='float: left; width: 190px; text-align: right; color: #6BC5FC;'>RequestInfor: </span>" +
  411. "<span style='float:left'>\t</span>";
  412. html += "<span class='MWFLogRequestAction' style='float: left;cursor: pointer; height: 20px; width: 16px; background: url(../x_component_LogViewer/$Main/default/right.png) no-repeat left center'></span>";
  413. html += "<span>"+o2.common.encodeHtml(request)+"</span></span><br/>";
  414. }
  415. html += "</pre>";
  416. this.node.set("html", html);
  417. this.checkbox = this.node.getElement(".MWFLogCheckbox");
  418. this.traceNode = this.node.getElement(".MWFLogStackTrace");
  419. this.requestNode = this.node.getElement(".MWFLogRequest");
  420. this.traceActionNode = this.node.getElement(".MWFLogStackTraceAction");
  421. this.requestActionNode = this.node.getElement(".MWFLogRequestAction");
  422. this.setEvent();
  423. },
  424. setEvent: function(){
  425. this.node.addEvents({
  426. "mouseover": function(){ this.node.setStyles(this.css.logItemNode_over); }.bind(this),
  427. "mouseout": function(){ this.node.setStyles(this.css.logItemNode); }.bind(this)
  428. });
  429. if (this.checkbox){
  430. this.checkbox.addEvent("click", function(e){
  431. this.checkSelected();
  432. e.stopPropagation();
  433. }.bind(this))
  434. }
  435. if (this.traceActionNode){
  436. this.traceActionNode.addEvent("click", function(e){
  437. this.expandOrCollapseTrace();
  438. e.stopPropagation();
  439. }.bind(this))
  440. }
  441. if (this.requestActionNode){
  442. this.requestActionNode.addEvent("click", function(e){
  443. this.expandOrCollapseRequest();
  444. e.stopPropagation();
  445. }.bind(this))
  446. }
  447. },
  448. checkSelected: function(){
  449. var range = document.createRange();
  450. range.selectNode(this.node);
  451. var s = window.getSelection();
  452. s.selectAllChildren(this.node);
  453. },
  454. expandOrCollapseTrace: function(){
  455. if (this.log.stackTrace){
  456. if (!this.isTraceExpanded){
  457. this.expandedTrace();
  458. }else{
  459. this.collapseTrace();
  460. }
  461. }
  462. },
  463. expandedTrace: function(){
  464. if (!this.traceAllNode) this.createTraceAllNode();
  465. this.traceAllNode.setStyle("display", "inline");
  466. this.traceActionNode.setStyle("background-image", "url(../x_component_LogViewer/$Main/default/down.png)");
  467. this.isTraceExpanded = true;
  468. },
  469. collapseTrace: function(){
  470. if (this.traceAllNode){
  471. this.traceAllNode.destroy();
  472. this.traceAllNode = null;
  473. }
  474. this.traceActionNode.setStyle("background-image", "url(../x_component_LogViewer/$Main/default/right.png)");
  475. this.isTraceExpanded = false;
  476. },
  477. createTraceAllNode: function(){
  478. var brNode = this.traceNode.getNext();
  479. this.traceAllNode = new Element("span").inject(brNode, "after");
  480. var traces = this.log.stackTrace.split(/[\r\n\t]/g);
  481. var html = "";
  482. traces.each(function(t, i){
  483. if (i!==0){
  484. html += "<span style='float: left; width: 190px;'>\t</span>" +
  485. "<span>\t</span>" +
  486. "<span>\t"+t+"</span><br/>";
  487. }
  488. }.bind(this));
  489. this.traceAllNode.set("html", html);
  490. },
  491. expandOrCollapseRequest: function(){
  492. if (this.log.requestUrl){
  493. if (!this.isRequestExpanded){
  494. this.expandedRequest();
  495. }else{
  496. this.collapseRequest();
  497. }
  498. }
  499. },
  500. expandedRequest: function(){
  501. if (!this.requestAllNode) this.createRequestAllNode();
  502. this.requestAllNode.setStyle("display", "inline");
  503. this.requestActionNode.setStyle("background-image", "url(../x_component_LogViewer/$Main/default/down.png)");
  504. this.isRequestExpanded = true;
  505. },
  506. collapseRequest: function(){
  507. if (this.requestAllNode){
  508. this.requestAllNode.destroy();
  509. this.requestAllNode = null;
  510. }
  511. this.requestActionNode.setStyle("background-image", "url(../x_component_LogViewer/$Main/default/right.png)");
  512. this.isRequestExpanded = false;
  513. },
  514. createRequestAllNode: function(){
  515. var brNode = this.requestNode.getNext();
  516. this.requestAllNode = new Element("span").inject(brNode, "after");
  517. var html = "";
  518. html += "<span style='float: left; width: 190px;'>\t</span>" +
  519. "<span style='float: left;'>\t</span>" +
  520. "<span style='color: #6BC5FC; width: 108px;'>requestRemoteAddr: </span><span>"+(this.log.requestRemoteAddr || "&nbsp;")+"</span>&nbsp;&nbsp;" +
  521. "<span style='color: #6BC5FC; width: 108px;'>requestRemoteHost: </span><span>"+(this.log.requestRemoteHost || "&nbsp;")+"</span>&nbsp;&nbsp;" +
  522. "<span style='color: #6BC5FC; width: 108px;'>requestBodyLength: </span><span>"+(this.log.requestBodyLength || "&nbsp;")+"</span>" +
  523. "<br/>";
  524. // if (this.log.requestHead) html += "<span style='float: left; width: 190px;'>\t</span>" +
  525. // "<span style='float: left;'>\t</span>" +
  526. // "<span style='float: left; color: #6BC5FC; width: 108px;'>requestHead: </span><span style='word-break:break-all;'>"+this.log.requestHead+"</span><br/>";
  527. var headers = this.log.requestHead.split(/\n/g);
  528. headers.each(function(head, i){
  529. if (i===0){
  530. html += "<span style='float: left; width: 190px;'>\t</span>" +
  531. "<span style='float: left;'>\t</span>" +
  532. "<span style='float: left; color: #6BC5FC; width: 108px;'>requestHead: </span><span>"+head+"</span><br/>";
  533. }else{
  534. html += "<span style='float: left; width: 190px;'>\t</span>" +
  535. "<span style='float: left;'>\t</span>" +
  536. "<span style='float: left; color: #6BC5FC; width: 108px;'>\t</span><span>"+head+"</span><br/>";
  537. }
  538. }.bind(this));
  539. if (this.log.requestBody){
  540. var bodys = this.log.requestBody.split(/\n/g);
  541. bodys.each(function(body, i){
  542. if (i===0){
  543. html += "<span style='float: left; width: 190px;'>\t</span>" +
  544. "<span style='float: left;'>\t</span>" +
  545. "<span style='float: left; color: #6BC5FC; width: 108px;'>requestBody: </span><span>"+body+"</span><br/>";
  546. }else{
  547. html += "<span style='float: left; width: 190px;'>\t</span>" +
  548. "<span style='float: left;'>\t</span>" +
  549. "<span style='float: left; color: #6BC5FC; width: 108px;'>\t</span><span>"+body+"</span><br/>";
  550. }
  551. }.bind(this));
  552. }
  553. // requestHead
  554. // requestRemoteAddr
  555. // requestRemoteHost
  556. // requestBodyLength
  557. // requestBody
  558. this.requestAllNode.set("html", html);
  559. }
  560. });