Powered by node.js + socket.io
Fork from Log.io
The purpose is to display the server / front log on the screen alone.
! Apply default https
-
Install via npm
npm install -g https://github.com/prugel/logio.git --user "ubuntu"
-
Run server
log.io-server
-
Configure harvester
nano ~/.log.io/harvester.conf
-
Run harvester
log.io-harvester
-
Browse to https://localhost:28778
https://github.com/prugel/logio
Send a log message, from web server to logio log_server
const options = {
port: '0.0.0.0',
host: 28777,
rejectUnauthorized: false
};
(server.ssl ? tls : net).connect(options, function(socket) {
const message = 'hello world';
send('+log', 'server', 'AwesomeWeb', 'info', message);
let message2 = 'another message';
const data = [{
hello: 'world',
step: 1
}, {
name: 'james',
step: 2
}];
data.forEach(function(meta) {
message2 += '\n'+JSON.stringify(meta, null, 4);
});
send('+log', 'server', 'AwesomeWeb', 'debug', message2);
function send() {
socket.write([].slice.call(arguments).join('|') + '\r\n');
}
});
const statusCode = Math.floor(data.statusCode/100)*100;
const responseTime = Math.min(Math.floor(data.responseTime/100)*100, 700);
const arr = [
moment(data.timestamp).format('YYYY MM DD A hh:mm:ss'),
`<span class="responseTime${responseTime}">(${data.responseTime}ms)</span>`,
`${data.pid}:`,
`<span class="status${statusCode}">${data.method}</span>`,
data.path,
JSON.stringify(data.query),
`<span class="status${statusCode}">${data.statusCode}</span>`,
];
this.send('+log', this.logio.stream, this.logio.node, '', arr.join(' '));
Send a log message, from web page to logio log_server
- ws: work fine
- wss: wss can not be used with a self signed certificate
- wss: web page -> web server -> logio log_server
var ws = new WebSocket("ws://0.0.0.0:28777");
send('+log', 'front', 'AwesomeWeb', 'info', message);
send('+log', 'front', 'AwesomeWeb', 'debug', message2);
function send() {
ws.send([].slice.call(arguments).join('|') + '\r\n');
}
! Allow html tags in messages. ! ansi to html apply
\x1b[30mblack\x1b[37mwhite
<span style="color:#000">black<span style="color:#AAA">white</span></span>
- response time
- status code
class | color |
---|---|
status200 | #2ca02c |
status300 | #1f77b4 |
status400 | #ff7f0e |
status500 | #d62728 |
- log level message
class | color |
---|---|
debug | #aec7e8 |
info | #86af49 |
warn | #f2ae72 |
error | #c94c4c |
- line
class | color |
---|---|
line | #2ca02c |
- time
class | color |
---|---|
time | #aaa |
clusterize.js Virtual scrolling applied.
-
Mike Smathers <[email protected]> (msmathers)
-
Narrative Science http://narrativescience.com (NarrativeScience)
-
Jeremy Ashkenas (jashkenas)
-
Guillermo Rauch <[email protected]> (Guille)
-
Ryan Dahl <ry at tiny clouds dot org> (ry) + Joyent http://www.joyent.com/ (joyent)
Copyright 2013 Narrative Science <[email protected]>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.