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

@koreanpanda/log-system

v1.10.3

Published

A Custom Logger that can print to the console, however you like, and writes logs for you as well.

Downloads

7

Readme

LogSystem

npm

Use @koreanpanda/inscriber now. This package will not managed, and will be removed sometime in November.

LogSystem is a Logging package that can not only print to the console in how you want it to be exactly for any of the types, but it can also Write Logs, to make it easier for those that need a log system, but don't know where to start. It is super simple, and easy to setup. Highly Customizable, down to the single character.

Note:

When a new version comes out, make sure you update the package by using npm update if you are using npm as your package manager, or yarn update, if you are using yarn. Then run your program. The package was built to add anything new to the config if it needs to, when it runs.

Installing LogSystem

If you are using npm:

$ npm i @koreanpanda/log-system --save

If you are using yarn:

$ yarn add @koreanpanda/log-system

To Initalize The Logger

const LogSystem = require("@koreanpanda/log-system");
const logger = new LogSystem();

when you run the code for the first time a file called log-system.config.json will be made in your root directory of your project. This file will be how you customize the Logger.

Log Patterns

Log Patterns are how you can structure the logs. You basically provide the template that you wish it to use, and let it do the rest. there are placeholders like time, and source. It defers on what log pattern it is for.

"logPatterns": {
    "error": "(<time>) [<type>] => {<source-short>}: <error>"
}

Log Colors

Log Colors is the color background and text you wish the logger to use for which type. Type the color you wish to use. Only background for now supports hex colors. and this is using chalk so text color should be lowercased like black, and if you want to use preset colors that chalk provides it should be proper case like Black.

"logColors": {
    "error": {
        "text": "black",
        "background": "#d44631"
    }
}

How can I make a certain section of the log to have color, but not the entire log?

each log method contains two tags. <color> and </color>. Place what you would like to be colored in between <color> and </color>, example:

"(<time>) <color>[ <source-short> ]</color> => <message>"

Do note that right now the color tags only support one thing to be colored at the moment. Later on in the future you will be color as many things as you wish.

How do I make it write logs?

in the config file, there is a key called writeToLog, make these true to enable it to create Logs. Make sure you have the base folder created for the Logger, so it knows where you wish to keep the log files.

Log Paths

Log paths are the directory of where you wish the logs to go to. by default it requires a folder called Logs made for it.

"logPaths": {
    "error": "./Logs/error"
}

How to change the time pattern?

In the config file there will be a key called timePattern, change this to be what you would like. This is using moment, so check moment's documentation for what kind of time patterns you can use. If it doesn't exist for you, then rerun your program, and it should be added to the config.