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

kazoologger

v0.1.0

Published

A simple server logging package

Downloads

2

Readme

kazoolog

Easy logging (5 min setup) for your js code (node, react, react-native, whatever)

Send your logs to our (or your server) and view them online https://kazoolog.netlify.app/logs/be682c8d-8f71-4695-b518-e81aaa6be846

alt text

How to use

Generate and copy in a textfile somewhere your api key and your secret url: https://kazoolog.netlify.app/newkeys

Install the npm module:

npm install kazoologger

Import the function in your application, for example in the index.js file of your react app:

import { kazooLoggerCreator } from "kazoologger";

After importing the function, export the new instance with your previously generated and saved API KEY:

export const kazooLog = kazooLoggerCreator({ APIKEY: "YOURAPIKEY" });

You can also specify an userId to distinguish your different clients, for example the expo installation id: https://docs.expo.io/versions/latest/sdk/constants/#constantsinstallationid

export const kazooLog = kazooLoggerCreator({
  APIKEY: "YOURAPIKEY",
  userId: "EXPO INSTALLATION ID",
});

If you don't specify anything, a uuid will be generated but I suggest you to generate it yourself and store it in localstorage, if you dont do it, a new uuid will be generated on each refresh. Here is an example on how to generate and store an uuid in localstorage:

let userId = localStorage.getItem("kazoologId");
console.log(userId);
if (userId === null) {
  userId = uuidv4();
  localStorage.setItem("kazoologId", userId);
}

export const kazooLog = kazooLoggerCreator({
  APIKEY: "YOURAPIKEY",
  userId: userId,
});

This is how the index.js of your React app could look like:

import React from "react";
import ReactDOM from "react-dom";
import { v4 as uuidv4 } from "uuid";
import localStorage from "localStorage";
import { kazooLoggerCreator } from "kazoologger";
import App from "./App";

let userId = localStorage.getItem("kazoologId");
console.log(userId);
if (userId === null) {
  userId = uuidv4();
  localStorage.setItem("kazoologId", userId);
}

export const kazooLog = kazooLoggerCreator({
  APIKEY: "YOURAPIKEY",
  userId: userId,
});

ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  document.getElementById("root")
);

Now you have to import the function where you want to log things and use it instead of console.log. For example this is a React component using the kazooLog function:

import { kazooLog } from "./index";

const SomeComponent = () => {
  kazooLog({ key: "value", key2: "value3" });
  kazooLog("text message");
  kazooLog("text and object message", { key: "value", key2: "value3" });
  return <p>I'm a component</p>;
};

export default SomeComponent;

The logs are still available in your console but they are also sent to a real time updated database you can check out here: https://kazoolog.netlify.app/YOURAPIKEYHERE

Replace YOURAPIKEYHERE with your api key, you should see all your past logs and without needing to refresh, the new logs coming in real time.

Click on a log to view it in full size