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

fie-log

v3.1.7

Published

fie日志模块

Downloads

53

Readme

fie-log

NPM version David deps Known Vulnerabilities npm download

以不同颜色在控制台上输出log

Installation

npm install fie-log --save

API

fie-log 返回的是一个方法, 调用该方法可以直接返回一个对象, 并进行调用, 大概操作如下:

const log = require('fie-log')('test');

// 普通字符串
log.info('啦啦啦'); // 将以紫色打印:  [test] 啦啦啦
log.cli.info('啦啦啦'); // 仅当前插件或套件做为入口模块时,才以紫色打印:  [test] 啦啦啦
log.func.info('啦啦啦'); // 仅当前插件或套件不是入口模块时,才以紫色打印:  [test] 啦啦啦

// 使用占位符
log.info('字符串:%s 数字:%d ', 'ssss', 33); // 会打印: [test] 字符串:ssss 数字:33
log.info('对象:%o', {a: 1}); // 打打印: [test] 对象:{a: 1}

以下提供的 info success warn error debug 方法均支持了 printf-style 格式化. 支持的格式化方式有:

| Formatter | Representation | |-----------|----------------| | %O | 多行打印对象 | | %o | 单行打印对象 | | %s | 字符串 | | %d | 数字 | | %j | JSON | | %% | 打印 ('%'). 并不代表任何占位符 |

info(msg)

以紫色打印

  • msg {string} 需要打印的内容

success(msg)

以绿色打印

  • msg {string} 需要打印的内容

warn(msg)

以黄色打印

  • msg {string} 需要打印的内容

error(msg)

以红色打印

  • msg {string} 需要打印的内容

debug(msg)

只有在环境变量 DEBUG 匹配到传入 fie-log 函数时的那个参数时才打印出来, 可参见 debug

  • msg {string} 需要打印的内容

cli

cli 为一个对象, 该对象具用跟上面声明的 info success warn error 用法一样的方法 唯一不同的就是 cli 下面的方法调用后只有当前插件或套件做为入口模块时 , 才打印对应的内容

const log = require('fie-log')('test');

log.cli.info('啦啦啦');
log.cli.error('啦啦啦');
log.cli.warn('啦啦啦');
log.cli.success('啦啦啦');

func

func 为一个对象, 该对象具用跟上面声明的 info success warn error 用法一样的方法 唯一不同的就是 func 下面的方法调用后只有当前插件或套件不是入口模块时 , 才打印对应的内容

const log = require('fie-log')('test');

log.func.info('啦啦啦');
log.func.error('啦啦啦');
log.func.warn('啦啦啦');
log.func.success('啦啦啦');

Support

使用过程中遇到的相关问题,及BUG反馈,可联系: hugohua [email protected] ,也可直接提issues

License

GNU GPLv3