Skip to content

Commit

Permalink
move protocol log option to top of cn (#727)
Browse files Browse the repository at this point in the history
  • Loading branch information
e9gille authored May 27, 2021
1 parent 6b3e4a2 commit df8ff37
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
32 changes: 16 additions & 16 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,22 @@
</div>
<hr>
<div id=cn_dtl>
<div class="row">
<div class="col col-xs-3">
<label class=cb_label>
<input type=checkbox id=cn_log_cb>
Save protocol <u>l</u>og</span>
</label>
</div>
<div class="col col-xs-9">
<div class="row">
<div class="col col-xs-12">
<input id=cn_log name=log placeholder="Log file" class=browse>
<button id=cn_log_dots class=tb_btn><span class="fas fa-ellipsis-h"></span></button>
</div>
</div>
</div>
</div>
<div id=cn_tcp_dtl>
<div class="row">
<div class="col col-xs-3"><label for=cn_tcp_host class=cn_label><u>H</u>ost:</label></div>
Expand All @@ -79,22 +95,6 @@
</label>
</div>
</div>
<div class="row">
<div class="col col-xs-3">
<label class=cb_label>
<input type=checkbox id=cn_log_cb>
Save protocol <u>l</u>og</span>
</label>
</div>
<div class="col col-xs-9">
<div class="row">
<div class="col col-xs-12">
<input id=cn_log name=cert placeholder="Log file" class=browse>
<button id=cn_log_dots class=tb_btn><span class="fas fa-ellipsis-h"></span></button>
</div>
</div>
</div>
</div>
<div id=cn_ssh hidden>
<div class="row">
<div class="col col-xs-3"><label for=cn_ssh_port class=cn_label>SSH <u>P</u>ort:</label></div>
Expand Down
5 changes: 4 additions & 1 deletion src/cn.js
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,7 @@
q.log.disabled = noLog;
q.log_dots.disabled = noLog;
q.log.value = noLog ? '' : defaultProtocolLogFile;
$(q.log).change();
D.util.elastic(q.log);
};
q.cert_cb.onchange = () => {
Expand Down Expand Up @@ -1069,7 +1070,9 @@
log = (x) => {
const msg = `${new Date() - t0} ${x}`;
if (protocolLogFile) {
try { fs.appendFileSync(protocolLogFile, `${new Date().toISOString()} ${x}\n`); } catch {}
try {
fs.appendFileSync(protocolLogFile, `${new Date().toISOString()} ${x}\n`);
} catch (e) { console.error(e); }
}
a[i] = msg;
i = (i + 1) % n;
Expand Down

0 comments on commit df8ff37

Please sign in to comment.