JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7
  • Score
    100M100P100Q49161F
  • License ISC

Capture console.log and server errors and display it in a very useful real-time screen to be able to view the console.log of the server in the browser

Package Exports

  • csb-inspector

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (csb-inspector) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

CSB-Inspector

It captures the impressions in the console produced by the action of the "console.log" or "console.error" function in the Application Server made in nodejs. This library is a help for the application developer on the server (BACKEND). There is a problem that at some point it is difficult to track the impressions on the console that we made at the time of development.

Also capturing the impressions in the console we emit in real time (SocketIo) to a display panel in the browser in the url 'http://{YourHost}:{SERVER_PORT}/_console'

Currently the library can be integrated into Expressjs and Loopback 3,

Install

npm i --save csb-inspector

How to Apply

...
const express = require('express');
const app = express();

const CsbInspector = require('csb-inspector/express-socket');

.....
.....
.....

const appInspector = CsbInspector({
        app: app
    });

Options

options = {
// express application (Required),
     app: app,
// Host the your server, by default it will be 'http://localhost' (Optional),
     host: 'http://localhost'
// Port where our Socket will point, by default it will be 8888 (Optional)
     port: 8888,
// Path where the application will be, by default it will be "_console" (Optional)
     route: "_console",
// This option receives the data from each screen impression and gives us the possibility of extending the functionalities (Optional)
     outputs: [(path, prop, args)=>{
           fs.appendFileSync("file.txt", path);
       }]
   }


CsbInspector(options);

Csb-Inspector Browser

Open your browser and load 'http://{YourHost}:{SERVER_PORT}/_console'

File Code "users-route.js"

fileImageI

View Csb-Inspector.

imageI

Impression on the console

CBS-Inspector displays these impressions on the console by adding the respective file name and code line where that impression was executed on the console.

File Code.

fileImage1

Your Console.

image1

Apply librery in to Loopback 3

If your application is working with Loopback 3 supported by ExpressJs then you must add in the middlewares configuration file (server/middleware.json) in the "final" object you must add a line to the configuration.

"final": {
    ...
    ...
    ...
    "csb-inspector/loopback-error": {}
}

imageLoopback