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

@khokonm/klogs

v1.0.1

Published

A universal logger for all your projects.

Downloads

8

Readme

Welcome to kLogs

The only log manager you'll ever need! Sponsored by Blog Desire

kLogs is a super simple logger for any of your projects. Some example use cases are tracking errors on your project. Sample SDK is available for some common languages. Yet, it's extremely simple to use with any programming language!

Primary Concept

The primary concept is pretty simple. You get the API key, you prepare your log, and send a post request with the log to the server. And the next time you visit the server, you can see all the logs you have prepared and sent to the server!

Get started with kLogs and JavaScript

First you load the kLogs SDK.

<script src="https://logs.khokon.dev/kLogs.js">

Or install via npm

npm install @khokonm/klogs

Make sure to require kLogs before using when installed via npm

const kLogs = require("@khokonm/klogs")

Then you create a new instance of the kLogs SDK.

var Logs = new kLogs('YOUR_API_KEY');

After that you prepare your log.

var log = {
  "message": "This is a log message",
  "source": "Project X",
  "medium": "ServerSide Script",
  "additional_info": {
    "server": "node-16",
    "note": "a sample note"
  }
};
Logs.prepare(log);

Finally you send the log to the server.

Logs.send();

The send method returns a promise. You can use the then method to get the response.

Logs.send().then((response) => {
  console.log(response);
});

and you can use the catch method to handle errors.

Logs.send().catch((error) => {
  console.log(error);
});

or you might want to use the async/await syntax.

const response = await Logs.send();
console.log(response);

Alltogether it should look something like this:

var Logs = new kLogs('YOUR_API_KEY');
var log = {
  "message": "This is a log message",
  "source": "Project X",
  "medium": "ServerSide Script",
  "additional_info": {
    "server": "node-16",
    "note": "a sample note"
  }
};
Logs.prepare(log);
const response = await Logs.send();
console.log(response);

Other Languages

kLogs still brand new and hasn't developed a lot more SDKs yet. But you can contact here to request for SDK in a new language. We will be happy to add it. But if you want to use kLogs in your language, you can use just follow these steps:

  1. Register here to get your API key.
  2. Initial a POST request
  3. Pass your api key in the header of the request (key: API-KEY)
  4. Pass your log in the body of the request
  5. Send the request to https://logs.khokon.dev/api

Body Parameters

The body of the request should be a JSON object. The following parameters are available currently:

  • message: The message of the log. (String, Required)
  • source: The source of the log. (String, Optional)
  • medium: The medium of the log. (String, Optional)
  • additional_info: Additional information of the log. (Object, Optional)

Limitations

kLogs is still in beta and it's 100% free. So, we had to put some limitations on the usage/number of requests. Here are some of them:

  • You can send at most 60 requests per minute.
  • You can send at most 500 requests per hour.
  • You can send at most 2500 requests per day.
  • You can send at most 25000 requests per month.

License

kLogs is licensed under the MIT license.

Contributing

If you want to contribute to kLogs, please check out here.

Version

kLogs version is 1.0.1.

Changelog