Skip to content
/ log-tv Public

Realtime nodejs logs in the browser using express and socket.io

Notifications You must be signed in to change notification settings

tno2007/log-tv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

log-tv

A super simple library to display realtime logs of your node application in the browser.

Installation

npm install log-tv --save

How to use

log-tv makes use of express and socket.io, so you will need those installed in your app.

var ltv = require('log-tv');

var app = require('express')();
var server = require('http').createServer(app);
var io = require('socket.io')(server);

ltv.setup(app, "/log", io);	
...
server.listen(3000);

// Now anywhere in your code, add some log messages
ltv.log("Server is listening on port 3000");

Now open your browser and point to the /log endpoint:

http://localhost:3000/log

The page that load will display your logs in real-time:

[2018-03-26 16:29:15] You are connected to the log-tv service!
[2018-03-26 16:29:22] A log message...
[2018-03-26 16:30:01] Another log message...

License

MIT

Todo

  • add string.format log string with require('util')
  • style up the log screen
  • keep the old log(...) statements in the log-tv console

About

Realtime nodejs logs in the browser using express and socket.io

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published