Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

console-mirroring

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

console-mirroring

Real-time console mirroring on a web page.

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

console-mirroring

This project aims to provide a Real-time console mirroring on a web page.

How it works

This module extends in your node app some console functions:

  • console.log
  • console.info
  • console.warn
  • console.error

Every function extended got his own color on the web page UI.

Install

npm install console-mirroring --save

NPM

Use

Just include it in your app passing a socket.io reference, like this:

    var app = require('express')();
    var server = require('http').Server(app);
    var io = require('socket.io')(server);
    server.listen(process.env.PORT || 8080);
    require('console-mirroring')(io);

    // Every console.* will be sent to the client web UI.
    console.log('Hello World'); // white
    console.info('Hello World'); // blue
    console.warn('Hello World'); // orange
    console.error('Hello World'); // red

Client side

    <div id="#console"></div>

    <script src="https://cdn.socket.io/socket.io-1.4.3.js"></script>
	<script src="browser.console.mirror.js"></script>

    <script type="text/javascript">
        var socket = io.connect('http://' + location.host, {
            'reconnect': true,
            'reconnection delay': 50,
            'max reconnection attempts': 300
        });

        // Make sure to pass a valid socket.io obj to the init method.
        consoleMirroring.init({
            socketLib: socket,
            containerId: '#console',
            fullScreen: true,
            border: false
        });
    </script>
Optional properties:
    {
        fullScreen: true/false,  // false by default
        border: true/false       // true by default
    }

Dependencies

  • Socket.io

Author

Rocco Musolino @roccomuso

License

MIT

Keywords

FAQs

Package last updated on 27 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc