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

fy-log

v1.0.4

Published

A beautiful console log utility with styled output

Readme

fy-log

一个美观的控制台日志工具,支持样式化输出。提供了多种预设样式,并支持自定义样式。

特性

  • 🎨 内置多种预设样式(success、error、warning、info、debug)
  • 💅 支持自定义样式
  • 🔍 优化的对象和数字显示
  • 📦 轻量级,无依赖
  • 📝 完整的 TypeScript 支持
  • ⛓️ 支持链式调用

安装

npm install fy-log

使用方法

import { log } from 'fy-log';

// 使用预设样式
log.success('操作成功');
log.error('发生错误');
log.warning('警告信息');
log.info('普通信息');
log.debug('调试信息');

// 支持多参数
log.info('用户', { id: 1, name: 'FengYe' }, '已登录');

// 数字会自动添加下划线样式
log.success('总计:', 100);

// 对象会自动格式化并高亮数字
log.info({
  name: 'FengYe',
  age: 25,
  scores: [98, 95, 100]
});

// 使用自定义样式
log.custom(
  {
    color: '#ff69b4',
    backgroundColor: '#fff0f5',
    padding: '2px 8px',
    borderRadius: '4px'
  }, 
  '自定义粉色主题'
);

// 使用原始 CSS 字符串
log.custom(
  'color: red; font-weight: bold; text-decoration: underline',
  '使用 CSS 字符串样式'
);

// 链式调用示例
log.success('第一步完成')
   .info('处理中...')
   .warning('注意!')
   .error('出错了')
   .debug('调试信息');

API

预设样式方法

  • log.success(...messages: any[]):成功信息,绿色主题
  • log.error(...messages: any[]):错误信息,红色主题
  • log.warning(...messages: any[]):警告信息,橙色主题
  • log.info(...messages: any[]):普通信息,灰色主题
  • log.debug(...messages: any[]):调试信息,蓝色主题

自定义样式

log.custom(style: CustomLogStyle | string, ...messages: any[])

style 可以是对象或 CSS 字符串:

// 样式对象
interface LogStyle {
  color?: string
  backgroundColor?: string
  padding?: string
  borderRadius?: string
  fontWeight?: string
  textDecoration?: string
  [key: string]: string | undefined  // 支持其他 CSS 属性
}

// 或直接使用 CSS 字符串
log.custom('color: purple; font-size: 14px;', 'Hello World');

特殊处理

  • 数字会自动添加下划线样式
  • 对象会自动格式化并美化显示
  • null 和 undefined 会直接显示为字符串
  • 多参数之间会自动添加空格

许可证

ISC