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

logzio-client-side

v1.0.3

Published

A logger for the client-side. Using Lgzio client-side logger is a secured way to log info, debug, error and warning messages from your front-end. This logger will send all your front-end logs to your backend and then to Logz.io.

Downloads

20

Readme

Logzio Client-side Logger

A logger for the client-side. Using Lgzio client-side logger is a secured way to log info, debug, error and warning messages from your front-end. This logger will send all your front-end logs to your backend and then to Logz.io.

client-side-architecture

Install

npm logzio-client-side

Setting the client-side logger

Import and build the logger on your client-side, as the following example:

import * as logzioLogger from 'logzio-client-side'

const logger = logzioLogger.Logger({
  url: `http://<<your url>>api/log`
});

Parameters:

| Parameter | Description | |---|---| | url (required)| Url to send logs to. | | prefix | prefix to add to all logs, delete if not needed | | log Level | Log level to display in the browser console, from: ERROR, WARN, INFO. Defaults to 'WARN' and 'ERROR' | | flushInterval | Interval to flush logs to server |

For an example of an elaborate logger configuration see our app demo.

Usage of the logger on the client-side:

    logger.info('this is an info log');
    logger.debug('this is a debug log');
    logger.warn('this is a warning log');
    logger.error('this is an error log');
    logger.flush();

Setting the server-side logger

Add the following code to your server side and change the parameters below:

const logzioServerLogger = require('logzio-client-side/server');
const app = logzioServerLogger.app;
const bodyParser = logzioServerLogger.bodyParser;
const port = <<port>>;

 const logzioShipper = logzioServerLogger.logzioLogger.createLogger({
    token: <<logzio-shipping-token>>,
    host: <<logzio-host>>,
    type: "logzio-client-side",
    debug: true
 });

app.use(bodyParser.json());

app.use(logzioServerLogger.expressEndpoint({
    uri: '/api/log', // Just an example
    logger: logzioShipper,
    enableCors: true
}));

app.listen(port, () => {
    console.log(`Listening at http://localhost:${port}`)
})

Parameters

General

| Parameter | Description | |---|---| | port (required)| The port you are sending your logs to. |

Logzio Shipper

| Parameter | Description | |---|---| | logs-shipping-token (required)| Add the log shipping token for the relevant Logz.io account. This is the account you want to ship to. | | logzio-host (required)| Use the listener URL specific to the region of your Logz.io account. You can look it up here. |

Logzio Server Logger

| Parameter | Description | |---|---| | uri (required)| URI to recieve logs at | | enableCors | Enable cross-origin requests to your logging endpoint |

For more configuration of the logzio-nodejs logger go to our docs. For an example of an elaborate logger configuration see our server demo.

Changelog

  • 1.0.2: Using 'require' for back-end
  • 1.0.0: Create logzio-client-side logger