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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@rklink/rklink-logger

v1.1.0

Published

A simple logger for frontend applications.

Downloads

498

Readme

RKLINK Logger

一个简单、轻量级的前端日志记录工具,支持日志分级、本地存储和导出功能。


✨ 功能特性

  • 日志分级: 支持 debug, info, warn, error 四个级别。
  • 本地存储: 所有日志自动保存到浏览器的 LocalStorage 中,方便追溯。
  • 日志导出: 可随时将日志下载为 JSON 文件,便于离线分析。
  • 轻量无依赖: 核心代码简洁,无任何外部依赖。
  • TypeScript 支持: 提供完整的类型定义。

📦 安装

npm install @rklink/rklink-logger

注意: 由于这是一个发布在 GitHub Packages 上的私有包,您需要在项目的根目录下创建一个 .npmrc 文件,并添加以下内容,以确保 NPM 能正确找到并下载它:

@Evil-GitHub:registry=https://npm.pkg.github.com/

🚀 快速使用

在您的代码中,直接导入 logger 实例即可使用。

import { logger } from "@rklink/rklink-logger";

// 记录不同级别的日志
logger.info("User logged in", { username: "test" });
logger.warn("API response is slow", { duration: 3000 });
logger.error("Failed to fetch data", { error: "Network Error" });

// 在需要时下载日志文件
function handleDownloadLogs() {
  logger.downloadLogs();
}

📖 API 参考

logger.debug(message, data?)

记录一条 DEBUG 级别的日志。

logger.info(message, data?)

记录一条 INFO 级别的日志。

logger.warn(message, data?)

记录一条 WARN 级别的日志。

logger.error(message, data?)

记录一条 ERROR 级别的日志。

logger.getLogs()

获取存储在 LocalStorage 中的所有日志条目数组。

logger.clearLogs()

清除 LocalStorage 中的所有日志。

logger.downloadLogs(filename?)

触发浏览器下载,将所有日志保存为一个 JSON 文件。

logger.getLogsSummary()

获取日志的统计信息,包括总数、错误数、警告数等。


📜 更新日志

1.0.5 (2025-11-10)

  • 重构: 发布到公共 NPM 仓库 (@rklink) 以实现免认证安装。

v1.0.0 (2025-11-07)

  • 初始版本发布。
  • 实现 debug, info, warn, error 日志记录。
  • 支持将日志存储到 LocalStorage
  • 提供 getLogs, clearLogs, downloadLogsgetLogsSummary 等辅助功能。

💻 开发与发布

1. 开发

在本地修改代码后,您可以通过 npm link 将本地包链接到测试项目中,以实时查看修改效果。

2. 构建

在发布新版本之前,务必运行 build 命令来编译 TypeScript 代码。

npm run build

3. 更新版本

根据您的修改,更新 package.json 中的 version 字段。例如,从 1.0.0 更新到 1.0.1

4. 登录

如果您是第一次发布,或登录已过期,需要先登录到 GitHub Packages。密码应为您在 GitHub 上生成的 Personal Access Token (PAT)

npm login --scope=@Evil-GitHub --registry=https://npm.pkg.github.com

5. 发布

最后,运行 npm publish 将新版本发布到 GitHub Packages。

npm publish

📜 更新日志

1.0.5 (2025-11-10)

  • 重构: 发布到公共 NPM 仓库 (@rklink) 以实现免认证安装。