npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

remote-logging

v1.4.4

Published

A tool to enable remote logging for AnaLogger

Downloads

90

Readme

Remote-Logging is a remote log viewer.

Preview

Installation

# Install modules globally
npm install remote-logging -g

or

# Run module with no installation step from a temporary directory
npx --yes remote-logging@lates

On Linux, you will need to open the port for the devices on your network can access the console.

Centos:

sudo firewall-cmd --add-port=12000/tcp --permanent
sudo firewall-cmd reload

Other distributions:

sudo iptables -A INPUT -p tcp --dport 12000 -j ACCEPT
sudo systemctl restart iptables

Refer to your distro for a more precise set-up.

On windows, it may ask to allow access to the port (12000 by default)

Browser to Remote Logging view


Usage

With Remote Logging, you can automatically console.log your data to the viewer.

From a Shell

$> remote-logging [--port 12000]

Demo

Send logs from a logger

To send logs from a logging system to remote-logging, you must send a POST request with the following format:

[
  [{"lid": 123888, "color": "blue"}, "My message 1"], 
  [{"lid": 123939, "color": "blue"}, "My message 2"],
  [{"lid": 123959, "color": "blue"}, "My message 3"],
]

The lid is a random number

$> curl --request POST 'http://your-server-ip:12000/analogger' --data-raw '[{"lid": 123888}, "My message"]'

Example with Postman

Postman to Remote Logging view


Send logs from a browser to Remote Logging

To send logs from the browser, you can use fetch and adapt the formatting above

fetch("http://localhost:12000/analogger", {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json'
    },
    body: JSON.stringify(/** Your formatted data **/),
    redirect: 'follow'
})
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Browser to Remote Logging view


Send logs from AnaLogger

You can send log from AnaLogger by passing true to the logToRemote option.

const {anaLogger} = require("analogger");
anaLogger.setOptions({logToRemote: true});                  

Go to the AnaLogger page for more options:

https://www.npmjs.com/package/analogger


Tests

Use Remote-Logging as a Mocha Test reporter

Mocha is a JavaScript test framework: https://www.npmjs.com/package/mocha

Description of how to have Remote-Logging working as an automated test viewer
  • Install Remote-Logging
$> npm install remote-logging
  • Launch Remote-Logging
# Port by default
$> remote-logging --port 8221
  • Pass the path of the reporter to Mocha
mocha --reporter=./node_modules/remote-logging/reporter.cjs

Preview

Reporter Options

To pass options to the reporter, use environment variables:

| Name | Description | Default | |-------------------------------------------|---------------------------------------------------|---------------------------------| | ANALOGGER_TEST_PORT | Port you wish to set the remote-logging server to | 8221 | | ANALOGGER_LOG_FILE | To add log into a file | | | ANALOGGER_LOG_TO_REMOTE_URL ** | To change the remote url for logging | http://localhost:8221/analogger | | ANALOGGER_LOG_TO_REMOTE_BINARY_URL ** | To change the address for screenshots | http://localhost:8221/uploaded |

** Set these if you have updated your AnaLogger configuration to point to custom URLs

Example

Linux:
export ANALOGGER_TEST_PORT=12000
export ANALOGGER_LOG_FILE=reporter.log 
mocha --reporter=./node_modules/remote-logging/reporter.cjs
Windows (Powershell)
$env:ANALOGGER_TEST_PORT = 12000
$env:ANALOGGER_LOG_FILE = "reporter.log" 
mocha --reporter=./node_modules/remote-logging/reporter.cjs

Uninstall Remote-logging

$> npm remove remote-logging -g

Changelog

current:
  • Fix Js error in reporter
1.4.2:
  • Display Remote-Logging version in the console
1.4.0:
  • Set up Remote Logging as a Mocha reporter
  • Open a new window with the application icon
  • Review screenshot viewer for takeScreenshot plugin
1.3.1:
  • Fix updater
1.2.0:
  • Release standard input in CLI after launching Remote-Logging
1.1.2:
  • Remove close button from splash screen progress bar
  • Display port in the notification
  • Show tray notification when the application starts
  • Review the exit button from the tray icon
  • Fix missing screenshots
  • Fix messages not being logged
  • Fix bug with failing ips
  • Select listening port with --port option
  • Review layout
  • Fix application launcher