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

@eastzhang/logcollector

v1.0.0

Published

Minimal lightweight logging for JavaScript,It can be used to collect logs and export them

Downloads

9

Readme

log-collect

log-collect是一个简单、轻量级的日志控制、采集模块。它使用浏览器的console方法,不会丢失行号、堆栈等信息,同时又能提供日志的级别控制,和日志的采集导出功能。

Features

简单

log-collect 使用浏览器自带的console,功能简单,是可以用来代替浏览器原生console的方法,同时提供日志级别和采集功能。可以很方便的使用它采集日志追踪问题。

实用

log-collect 没有更多的功能,但都是很实用的,可以用它做日志级别控制,也可以很方便的使用它采集日志来追踪问题,同时可以设置日志缓存的大小(默认3M),从而不影响性能。

Download

npm install @log-collector --save-dev

示例

引入:

import Logger from @log-collector

Logger.trace('trace')
Logger.warn('warn')
Logger.debug('debug')
Logger.info('info')

// 也可以获取一个新的logger
const logger = Logger.getLogger('test logger')
logger.log('test logger')

APIs

  • getLogger(name): 获取一个新的Logger实例,可以使用多个Logger实例来打印日志,每个实例的日志都可以保存

  • getLoggers(): 获取全部Logger实例

  • setLevel(): 设置日志级别levels = { "TRACE": 0, "DEBUG": 1, "INFO": 2, "WARN": 3, "ERROR": 4, "SILENT": 5 }, 默认为DEBUG

  • getLevel(): 获取当前日志级别

  • enableAll(): 允许打印、采集全部日志

  • disableAll(): 禁止打印所有日志

  • getLogs(): 获取采集的日志

  • setConfig(config): config={ useCache: false, //是否采集缓存日志 maxCache: 310241024 //缓存日志最大值 }

License

Copyright (c) 2020 eastzhang
Licensed under the MIT license.

github