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

hooli-logger-client

v1.0.7

Published

A logger server aggregator client

Downloads

28

Readme

Hooli logger server

Behind the need to see and control the logs of applications and microservices based on express and NodeJS that run in containers through serverless infrastructure from any provider, and with easy integration without complications and for free.

The leganux team developed a set of tools that would solve these problems in a very simple way. The Hooli logger project allows users of node/express projects to implement a fast, efficient and visual service that allows them to manage their logs.

This service allows you to view, analyze, filter and obtain the context of:

  • console.log
  • console.info
  • console.warn
  • console.error
  • console.debug *http requests

In real time and in a visual and managed way

How to use

Configure ExpressJS basic project server

First clone the server repository

$ git clone "https://github.com/leganux/hooli-logger-server.git"

Install the dependences

$ npm i

Modify Configuration Config.js

module.exports = {
  log_rotate_cron: '0 * * * *', //indicates every time runs cron of log rotate
  log_rotate_hours: 12,//indicates delete data from 12 hour back
  listen_port: 3333,//Port wich run server
  db_flavor: 'sqlite', /* sqlite, mariadb, mysql*/
  db_host: 'localhost', //host server DB  of not sqlite
  db_port: '00000',//port DB  of not sqlite
  db_username: '',//username DB  of not sqlite
  db_password: '',//password DB  of not sqlite
  db_filename: 'my_db.sqlite', // only for sqlite
  db_name: 'hooli', //  for all databases
  user: 'hooli', // Coming soon login
  password: 'CFm7AWR3tezcuyBg', // Coming soon login
}

Run server

$ node app.js

Visit website

https://myhostdomain.com:3333/web

Configure Client in your node project

Install package

npm i hooli-logger-client

Import package

let hooli = require("hooli-logger-client")

New instance declaration

let logger = new hooli('https://myhostdomain.com:3333', 'The name of your APP', 'The source. EG. ID container or Environment')

Replacing default log functions from NodeJS console

const _privateLog = console.log;
const _privateError = console.error;
const _privateInfo = console.info;
const _privateWarn = console.warn;
const _privateDebug = console.debug;

console.log = async function (message) {
  _privateLog.apply(console, arguments);
  logger.log(arguments)

};
console.error = async function (message) {
  _privateError.apply(console, arguments);
  logger.error(arguments)
};
console.info = async function (message) {
  _privateInfo.apply(console, arguments);
  logger.info(arguments)
};
console.warn = async function (message) {
  _privateWarn.apply(console, arguments);
  logger.warn(arguments)
};
console.debug = async function (message) {

  _privateDebug.apply(console, arguments);
  logger.debug(arguments)

};

For requests install Morgan Middleware in express

npm i morgan
let morgan = require('morgan')

app.use(morgan(function (tokens, req, res) {

  let cadenamorgan = [
    moment().format('YYYY-MM-DD hh:mm:ss'),
    tokens.method(req, res),
    tokens.url(req, res),
    tokens.status(req, res),
    tokens['response-time'](req, res), 'ms'
  ].join('  ');

  /*  Implement request logger  */
  logger.request(JSON.stringify({
    method: tokens.method(req, res),
    url: tokens.url(req, res),
    status: tokens.status(req, res),
    body: req.body,
    query: req.query,
    params: req.params,
  }))

  return cadenamorgan;
}));

And that's all folks