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

@jupiterjs/jupiter-log

v0.0.5

Published

一个打印日志的类

Downloads

9

Readme

使用说明

使用环境

  • 浏览器
  • node

日志输出格式

时间 / 项目名称 / 日志类型(可选) / 日志信息 / 代码执行栈(可选)

举例说明

warn('event','点击事件中得到的参数不是有效的结构',args)
// 结果:[2021-09-24][项目名][event]点击事件中得到的参数不是有效的结构 {paramName:undefined}

支持类型

方法名 | 参数 | 说明 ---------|----------|--------- info | [...rest]:Array | 用于打印信息场景 warn | [...rest]:Array | 用于打印警报信息场景 error | [...rest]:Array | 用于打印错误信息场景 debug | [...rest]:Array | 用于打印调试信息场景(mode=development)有效

配置说明

项目会导出一个 config 类,用于与外部使用者对接配置。

属性名 | 默认值 | 说明 ---------|----------|--------- moduleName | bos-fe-log-node | 全局配置模块/项目名称 mode | development | 可选 development / production 两种模式

单元测试用例

import { warn, info, debug, error, config } from '../src/index'

beforeAll(() => {
  config.moduleName = 'MoonJS'
})

test('1.检验 info 函数', () => {
  info('测试一个日志')
  info('类型', '打印了一个日志')
  info('类型', '打印了一个日志', { name: '张三' })
})

test('2.检验 warn 函数', () => {
  warn('测试一个警告日志')
  warn('类型', '这个函数发生了警告')
  warn('类型', '这个函数发生了警告', { a: 1 })
})

test('3.检验 error 函数', () => {
  error('测试一个错误日志')
  error('类型', '这个函数发生了错误')
  error('类型', '这个函数发生了错误', new Error('发生了未知错误'))
})

test('4.检验 debug 函数', () => {
  debug('测试一个 debug 日志')
  debug('类型', '这是一个  debug 日志')
  debug('类型', '这是一个  debug 日志', new Error('发生了未知错误'))
})