Code Monkey home page Code Monkey logo

remote-device-logger's Introduction

remote-device-logger

A logging tool for a remote device equipped with no inspector to send a log to the receiver via WebSocket.

Remote Device Logger receiver screenshot Remote Device Logger sender screenshot

Install

$ npm i remote-device-logger --save-dev

Usage

Start the remote-device-logger cli on the server-side. This is the log receiver.

$ remote-device-logger -p 8080

Send logs from the client-side.

import RDL from 'remote-device-logger';

const logger = new RDL({
  element: document.body,
  webSocketUrl: `ws://${ location.hostname }:8080`,
});

// log() method sends and displays logs.
logger.log('Client launched');
logger.log('This log message is sent by Remote Device Logger');

// remote-device-logger catches errors, too.
throw new Error('Please catch this error');

You will find logs on the client-side and the same logs in the standard output on the server-side.

Log receiver is listen on 8080
Client says: {"message":"Uncaught Error: Please catch this error","fileName":"http://localhost:8000/example","lineNumber":17,"columnNumber":7,"location":"http://localhost:8000/example","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.90 Safari/537.36"} This log message is sent by Remote Device Logger Client launched
Client says: WebSocket opened

API Document

https://ygoto3.github.io/remote-device-logger/class/remote-device-logger/index.js~RemoteDeviceLogger.html

Run the example

Start the receiver

$ yarn receiver

Start the Web server

$ yarn example

Then, open http://localhost:8000/example

remote-device-logger's People

Contributors

ygoto3 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.