https://github.com/tno2007/log-tv
Realtime nodejs logs in the browser using express and socket.io
https://github.com/tno2007/log-tv
express logs nodejs realtime socket-io
Last synced: 5 months ago
JSON representation
Realtime nodejs logs in the browser using express and socket.io
- Host: GitHub
- URL: https://github.com/tno2007/log-tv
- Owner: tno2007
- Created: 2018-03-27T20:38:07.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-31T19:35:15.000Z (about 8 years ago)
- Last Synced: 2025-09-20T09:08:59.551Z (9 months ago)
- Topics: express, logs, nodejs, realtime, socket-io
- Language: JavaScript
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# 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](LICENSE)
## Todo
- add string.format log string with require('util')
- style up the log screen
- keep the old log(...) statements in the log-tv console