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

express-walklogger

v2.1.3

Published

the basic logging package by walkover.

Downloads

33

Readme

A logger for just about everything. the walkover product.

Motivation

logging is very essential part of any application when you debug ,it helps you a alot. So it is useful for logging purposes.

Documentation

to install express-walklogger use

    npm i express-walklogger 

once you install the package create config.yml file and put the details below into it.make sure you put this file in your folders main directory and change the path to wherever you want to dump your data.

config.yml

app:
    projectId: mnv566zVnopjyFZbTuzkxuJ 
    authkey: 1S5J3pa2uudmWHuR5syuNZ
    include: ["*"]
    level: "INFO"
    backuptime: 0
    healthSummaryTime: 1
    flow: { 
        "/api/v1/tours/:id": {
            endpoint: tourById,
            condition:  [["res.body.data.data.price", '>=', 397], '&&', ["res.body.data.data.name", '!=', "The Forest Hiker"], '&&', ["res.body.data.data.duration", '>=', 5]]
        }
        ,
        "/api/v1/tours/tours-within/:distance/center/:latlng/unit/:unit": {
            endpoint: distance,
            condition: [["res.body.data.data[0].duration",'!=',5],"||",["res.body.data.data[0].ratingsAverage",">",4],"&&",["res.body.data.data[0].ratingsQuantity",">=",7]]
        }
        ,
        "/api/v1/users/":{
            endpoint: users,
            condition: [["res.body.data.data.name",'==',"Praveen Sharma"]]
        }
        ,
        "/api/v1/users/:id":{
            endpoint: userId,
            condition:  [["req.body.name",'==',"Praveen Sharma"],'&&',["req.method","==","PATCH"],'&&',["req.body.roles","==","admin"]]
        },

        "/api/v1/users/login":{
            endpoint: login,
            condition: [["res.statusCode",'==',200]]
        },
        "/api/v1/reviews/:id":{
            endpoint: reviews,
            condition: [["res.body.data.data.rating",'>=',5]]
        },
        "/api/v1/users/me":{
            endpoint: currentUser,
            condition: [["res.body.data.data.roles",'==',"admin"]]
        },
        "/api/v1/tours/monthly-plan/:year":{
            endpoint: monthly-plan,
            condition: [["res.body.data.plan[0].month",'>',7]]
        },
    }
    # set true on uncaughtAndUnhandleException if you want to log uncaughtException and unhandleRejection.
    uncaughtAndUnhandleException: true,   
    
     
    

in place of projectId put your own projectId where you want to dumb the data and in place of authkey put your authkey provided by viaSocket project authkey.

in include array you need to pass the route which you allow to log.if you put "*" it means you want to allow all the route.

once you done with config file just put the code below to the top of all your route so that it will process all your route. (REMEMBER:- put this above all your route. )

const express = require('express');
const logger = require('express-walklogger');

const app = express();

app.use((req, res, next) => {
    let oldSend = res.send;
    res.send = function(data) {
        try {
            res.body = JSON.parse(data);
        } catch (e) {
            res.body = data;
        }
        oldSend.apply(res, arguments);
    }
    res.on('finish', function() {
        req.routePath = req.route.path;
        logger.setexecuteendpoint(req, res);
    });

    next();
});

if you want to use logger for logging uncaughtException and unhandleRejection also then just add this code below in your project :-

process.on('uncaughtException', err => {
    logger.uncaughtAndUnhandleException(reason);
});

process.on('unhandledRejection', (reason, promise) => {
    logger.uncaughtAndUnhandleException(reason);
})

if you want to use logger for specific task like INFO,ERROR,WARNING use like :-

const logger = require('express-walklogger');

logger.info("dumpPoint","Success");
logger.warning("dumpPoint","Warning");
logger.error("dumpPoint","Error");

"dumpPoint" is nothing but your flow endpoint where you want to dumpdata. for example:-https://sokt.io/${config.app.projectId}/${dumpPoint}

LOGGER LEVEL

level:"INFO"

if you set level:"INFO", then all log of "INFO","WARNING" and "ERROR" is log.

level:"WARNING"

if you set level:"WARNING", then all log of "WARNING" and "ERROR" is log, "INFO" log is not shown.

logger.error("error"); error log is always log and dump.