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

mlite

v0.0.6

Published

Wrapper for LOGLITE service

Downloads

92

Readme

mlite A simple "Log and go" NodeJS wrapper for LOGLITE

What is LOGLITE?

Loglite is a very simple, lightweight, cloud-based logging service. It is slightly similar to Loggly but stripped of some more advanced features. Loglite provides logging with keys and a means to storify function / service calls in your node js applications. No registration / login required. All you need to get going is a valid LOGLITE token. You can get one here https://loglite.herokuapp.com/. To view logs associated with your token, you can do so here https://loglite.herokuapp.com/logs.html (You will also need to provide your LOGLITE token)

Using mlite

To use mlite, the first thing you need to do is get a LOGLITE token. You can get one for free from here https://loglite.herokuapp.com/ After you have gotten your LOGLITE token, install mlite using NPM:

npm install mlite

You can then use mlite in your NodeJS code like so:

var mlite = require('mlite')('YOUR LOGLITE TOKEN');
mlite.log(DATA_TO_LOG, OPTIONAL_KEY, TYPE);

DATA_TO_LOG Is what you wish to log. OPTIONAL_KEY Is a key (any string value) you can use to track logged entries. Very useful for storifying function calls. It is optional TYPE Is just for semantics and rendering on the LOGLITE dashboard. Examples could be warning, info, error e.t.c. To this end, mlite provides helper functions for basic log types. You can do any of the following:

mlite.info('DATA_TO_LOG', 'OPTIONAL_KEY'); //type is passed as INFO
mlite.warning('DATA_TO_LOG', 'OPTIONAL_KEY'); //type is passed as WARNING
mlite.error('DATA_TO_LOG', 'OPTIONAL_KEY'); //type is passed as ERROR
mlite.errorX('DATA_TO_LOG', 'OPTIONAL_KEY'); //type is passed as ERROR-X

NOTE: mlite.errorX('DATA_TO_LOG', 'OPTIONAL_KEY') Will attempt to stringify and log the stack trace if DATA_TO_LOG is an instance of the Error object while mlite.error('DATA_TO_LOG', 'OPTIONAL_KEY'); will log the data passed to it as is.

Also, it's possible to use mlite with a custom LOGLITE build. You can deploy and host your own LOGLITE instance. If this is the case, your mlite initialization will look something like this:

var mlite = require('mlite')('CUSTOM_LOGLITE_TOKEN', 'CUSTOM_LOGLITE_SERVERURL');
//use mlite as you'd normally
mlite.log('somedata'); //Log can be retrieved from your custom LOGLITE server