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

sleeklogs

v1.0.7

Published

A library for better looks and better logs.

Downloads

11

Readme

SleekLog

SleekLog is a Node.js logging library designed to enhance the way developers log information in their applications. This library provides customizable and color-coded log outputs, file logging capabilities, and support for custom log levels, making it versatile for both development and production environments.

Features

  • Color-coded Log Output: Customize log colors for better visual distinction between log levels.
  • Custom Log Levels: Define and use custom log levels that suit your application's needs.
  • File Logging: Enable logging to a file for persistent log storage.
  • Error Handling with Traceability: Log errors with stack traces for easier debugging.
  • Bar Chart Logging: Draw ASCII bar charts in the console for visual representation of metrics like CPU and memory usage.
  • Flexible Configuration: Configure logging preferences such as file logging paths and whether to enable or disable certain features.

Supported Colors

SleekLog supports the following colors for log customization:

  • Foreground Colors:

    • Black: \x1b[30m
    • Red: \x1b[31m
    • Green: \x1b[32m
    • Yellow: \x1b[33m
    • Blue: \x1b[34m
    • Magenta: \x1b[35m
    • Cyan: \x1b[36m
    • White: \x1b[37m
  • Background Colors:

    • Black: \x1b[40m
    • Red: \x1b[41m
    • Green: \x1b[42m
    • Yellow: \x1b[43m
    • Blue: \x1b[44m
    • Magenta: \x1b[45m
    • Cyan: \x1b[46m
    • White: \x1b[47m

Installation

Install SleekLog using npm:

npm install sleeklogs

Please do not use

@lmaoleonix/sleeklogs

It's the same but just use sleeklogs.

Usage

Here's how to get started with SleekLog:

const SleekLog = require('sleeklogs');
const logger = new SleekLog({
    enableFileLogging: true,
    levels: {
        debug: { color: "\x1b[36m" }  // Example of the custom log level
    }
});

logger.log('info', 'This is an informational message.', '#E1E1E1'); // Example using hex color
logger.log('debug', 'This is a custom debug message.');
logger.logError('An error occurred', new Error('Something went wrong'));

// Example of drawing a bar chart for CPU and memory usage
const currentCpuUsage = 30;
const totalCpuCapacity = 100;
const usedMemory = 4;
const totalMemory = 16;

logger.drawBar('CPU Usage', currentCpuUsage, totalCpuCapacity, 40);
logger.drawBar('Memory Usage', usedMemory, totalMemory, 40);

// A nice spinner if you need it for loading something
logger.startSpinner(5000, 'Processing data...', logger.colors.fg.magenta);
setTimeout(() => {
  console.log('Operation completed.');
}, 6000);

Reporting Issues

Please report any bugs or issues you find while using SleekLog on our GitHub Issues page.

License

This project is licensed under the MIT License - see the LICENSE file for details.