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 🙏

© 2026 – Pkg Stats / Ryan Hefner

xulogger

v1.0.3

Published

Very Simple and Strong Logger

Readme

xulogger

npm

this is a simple and easy logger! screenshot

How to install?

npm install xulogger

How to use?

First. Please import it and create logger, like this:

import xulogger = require("xulogger")

// Create Logger
let logger = new xulogger.Logger();
// Add Console Log
logger.AddLog(new xulogger.ConsoleLog(xulogger.Level.All));
// Add File Log
logger.AddLog(new xulogger.FileLog(xulogger.Level.All, "log.txt", true));

Next, record your log!

logger.Info("This is a Info. Enjoy your life! :3");
logger.Debug("Debug Message is very useful! So let's debug it!");
logger.Warning("Warning! Warning! BOSS coming!!")
logger.Error("WTF! Life is a big advantage!");
logger.Info("Easy? Interesting? Get it https://github.com/xerysherry/xulogger !");

Use Config

Use Config is Recommanded! This is a example config typescript file

import xulogger = require("xulogger")
export = [
    // Console Log
    {
        type: "ConsoleLog",
        level: "All", //or xulogger.Level.All
        // paint mode value
        paint: [
            {key:/Error/gi, colors:["red", "underline"]},
            {key:/Warning/gi, colors:"yellow"},
            {key:/Debug/gi, colors:["blue", "bold"]},
            {key:/Info/gi, colors:["green", "bold"]},
        ],
        // default = false
        nopaint: false,
    },
    // File Log
    {
        type: "FileLog",
        level: xulogger.Level.All,
        file: "./all_log.txt",
        // roll file, all_log_yyyy_mm_dd.txt ~ all_log.txt
        // default = false
        roll: true,
    },
]

You can import it, and create logger

// Import config file
import config = require("./sample_config")
// Create logger by config
let logger = new xulogger.Logger(config);

In /config_sample, you will find config file use by JavaScript.

Console Log Config

{
    // log level include
    // Error, Debug, Warning, Info
    // Level_1 (Error)
    // Level_2 (Error | Debug)
    // Level_3 (Error | Debug | Warning)
    // Level_4 (Error | Debug | Warning | Info)
    // All = Level_4
    level: string|xulogger.Level;
    // Paint config, see colors.ts <https://github.com/xerysherry/colors.ts>
    paint?: Colors.Painter[];
    // Paint disable
    nopaint?: boolean;
}

File Log Config

{
    // see Console Log Config
    level: string|xulogger.Level;
    // filepath
    file: string;
    // roll file, all_log_yyyy_mm_dd.txt ~ all_log.txt
    // default = false
    roll?: boolean;
}

Custom Log

Implement xulogger.ILog, like this

export class MyCustomLog implements xulogger.ILog
{
    constructor(config?:any)
    {}
    Log(level:xulogger.Level, message:string)
    {
        console.log("[MY_CUSTOM_LOG] " + message);
    }
}

config like this

export = [ 
    {
        type:"Custom",
        custom: "MyCustomLog.js",
        class: "MyCustomLog",
    },
    // or
    {
        type:"Custom",
        custom: c => { return new MyCustomLog(c); },
    },
    // or
    {
        type:"Custom",
        custom: new MyCustomLog(),
    }
]

Thank you for use. Please Enjoy it.

xulogger

npm

一个简单并强大的logger screenshot

如何安装?

npm install xulogger

如何使用?

首先,引用它,并创建日志器

import xulogger = require("xulogger")

//创建日志器
let logger = new xulogger.Logger();
//添加一个命令行日志
logger.AddLog(new xulogger.ConsoleLog(xulogger.Level.All));
//添加一个文件日志
logger.AddLog(new xulogger.FileLog(xulogger.Level.All, "log.txt", true));

接下来,就开始记录你的日志吧!

logger.Info("This is a Info. Enjoy your life! :3");
logger.Debug("Debug Message is very useful! So let's debug it!");
logger.Warning("Warning! Warning! BOSS coming!!")
logger.Error("WTF! Life is a big advantage!");
logger.Info("Easy? Interesting? Get it https://github.com/xerysherry/xulogger !");

使用配置

推荐使用配置 下面是一个配置的例子

import xulogger = require("xulogger")
export = [
    //命令行日志
    {
        type: "ConsoleLog",
        level: "All", //or xulogger.Level.All
        //着色配置
        paint: [
            {key:/Error/gi, colors:["red", "underline"]},
            {key:/Warning/gi, colors:"yellow"},
            {key:/Debug/gi, colors:["blue", "bold"]},
            {key:/Info/gi, colors:["green", "bold"]},
        ],
        //是否禁用着色
        nopaint: false,
    },
    //文件日志
    {
        type: "FileLog",
        level: xulogger.Level.All,
        file: "./all_log.txt",
        // 日志翻滚, all_log_yyyy_mm_dd.txt ~ all_log.txt
        // default = false
        roll: true,
    },
]

你可以引用它,并同配置创建日志器

// 引用日志配置
import config = require("./sample_config")
// 用配置创建日志器
let logger = new xulogger.Logger(config);

在/config_sample文件夹下, 你可以找到用JavaScript写的日志配置模板

命令日志配置

{
    // 日志输出级别,包括
    // Error, Debug, Warning, Info
    // Level_1 (Error)
    // Level_2 (Error | Debug)
    // Level_3 (Error | Debug | Warning)
    // Level_4 (Error | Debug | Warning | Info)
    // All = Level_4
    level: string|xulogger.Level;
    // 着色配置, 相关参看colors.ts <https://github.com/xerysherry/colors.ts>
    paint?: Colors.Painter[];
    // 是否禁用配置
    nopaint?: boolean;
}

文件日志配置

{
    // 参看命令行配置说明
    level: string|xulogger.Level;
    // 文件路径
    file: string;
    // 文件翻滚, 
    // 启用后,每天的日志会归档到[filename]_yyyy_mm_dd下,
    // 但是当天的文件已经写入[filename][.ext]下
    // 默认为false
    roll?: boolean;
}

自定义日志

使用自定义日志,先实现xulogger.ILog接口,像这样:

export class MyCustomLog implements xulogger.ILog
{
    constructor(config?:any)
    {}
    Log(level:xulogger.Level, message:string)
    {
        console.log("[MY_CUSTOM_LOG] " + message);
    }
}

在配置文件中这样定义:

export = [ 
    {
        type:"Custom",
        custom: "MyCustomLog.js",
        class: "MyCustomLog",
    },
    // 或者
    {
        type:"Custom",
        custom: c => { return new MyCustomLog(c); },
    },
    // 或者
    {
        type:"Custom",
        custom: new MyCustomLog(),
    }
]

感谢使用它,希望你喜欢!