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

resitail

v1.5.3

Published

Stream your residue server logs using hooks

Downloads

249

Readme

Resitail

Version Apache 2.0 license

Donate

Stream residue server logs via various hooks

Quick start

  • npm install -g resitail
  • sudo resitail --config <config>

Notice the sudo, this is because all the files written by residue server will need sudo access as they may be owned by one user or another with limited permissions. Resitail needs to be able to read all of these log files.

Configuration

A configuration file looks like:

{
    "residue_config" : "<residue-config>",
    "hooks": [
    ... <see Connecting Hooks section below>
    ]
}

Creating Hook

Hook is essentially a JS module with following minimal requirements

  • A class with options constructor
  • A send function with data parameter.
  • Export this class

Once connected resitail will use this send function to send the logs

A most commonly used hook is resitail-f. It is even used in production servers for muflihun.com

Example:

"use strict";

function sampleHook (options) {
    this.options = options;

    this.send = (data) => {
        console.log(data);
    }
}

module.exports = (options) => new sampleHook(options);

Data contains following properties:

| Property | Description | |----------|-------------| | event | Event name (i.e, resitail:line, resitail:err) | | event_type | Type of event (i.e, info, error) | | line | Contents of event (either log line or error details etc) | | channel | Type of channel (i.e, client or logger)| | channel_name | Name of channel (i.e, client_id or logger_id) | | logger_id | Logger ID if channel is client| | client_id | Client ID if channel is logger|

Connecting Hook

Once hook is ready you can connect it by adding it to configuration.

{
    "name": "<hook name>",
    <path or package>
    "enabled": false,
    "config": {
        "channels" : {
            "to_client" : true,
            "to_logger" : true
        }
        ... more configs specific to hook
    }
}

A fully working hook configuration looks like:

From registry (notice package and version):

{
    "name": "resitail-f",
    "package": "resitail-f",
    "version": "latest"
    "enabled": true,
    "config": {
        "channels" : {
            "to_client" : true,
            "to_logger" : true
        }
        port: 3000
    }
}

This will install the package globally.

Local (notice path):

{
    "name": "resitail-f",
    "path": "../resitail-f",
    "enabled": true,
    "config": {
        "channels" : {
            "to_client" : true,
            "to_logger" : true
        }
        port: 3000
    }
}

Notes

License

Copyright 2017-present Zuhd Web Services
Copyright 2017-present @abumusamq

https://github.com/zuhd-org/
https://muflihun.com/
https://zuhd.org

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.