New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

pretty-log-plugin

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pretty-log-plugin

美化控制台日志🤖

  • 1.1.7
  • unpublished
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Pretty Log Plugin

log

🎉 Pretty Log Plugin

路虽远行则将至,事虽难做则必成!

Pretty Log Plugin 是一个用于美化日志输出的 JavaScript 库,适用于 Node.js 和浏览器环境。它提供了多种日志级别和格式,帮助开发者更容易地追踪和分析日志信息。

功能特点

  • 多种日志级别:支持 info, warning, error, success 等日志级别。
  • 颜色区分:不同级别的日志使用不同颜色高亮显示。
  • 环境适应:自动检测环境,只在非生产环境下输出日志。

安装

使用 npm 安装:

npm install pretty-log-plugin

使用

  • 第一种方式:
import log from "pretty-log-plugin";
log.info("Hello, world!");
  • 第二种方式:
  • 1:在 main.ts 文件中,确保您将 log 正确地绑定到了 window 对象上:
import log from "pretty-log-plugin";
window.log = log;
  • 2:在 src\types\global.d.ts 扩展 Window 接口
import log from "pretty-log-plugin";
declare global {
    interface Window {
    log: PrettyLogFunctions;
    }
}

直接使用即可:

window.log.info("Hello, world!");
window.log.warning("警告标题", "警告内容");

alt text 可参考文章链接: 👍 戳我

API

log.info(message)

输出信息级别的日志。

log.error(message)

输出错误级别的日志。

log.warning(message)

输出警告级别的日志。

log.success(message)

输出成功级别的日志。

贡献

欢迎通过 GitHub 提交问题或拉取请求来贡献代码。

许可证

本项目采用 MIT 许可证

FAQs

Package last updated on 28 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc