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

logci

v0.4.3

Published

Lightweight logging and reporting for JavaScript

Downloads

3

Readme

LogCI (Log Cloud Index)Build Status

LogCI是一款轻量级的JavaScript环境下的日志管理工具。它具有两大功能:

  1. 可控制的console,LogCI的log, info, warn, error方法是对应console方法的封装,你可以在开发版本中任意使用这些方法,便于开发,然后在生产版中配置LogCI,禁用log, info, warn, error部分或全部,不干扰生产版的运行。
  2. 日志云同步,LogCI的log, info, warn, error方法还可以将收集到的日志信息同步到云服务器(logci.com,开发中),方便进行日志分析,监控程序运行状态。在浏览器中,LogCI使用Image对象同步日志记录;在node.js中,LogCI使用http.get方法同步日志记录。

安装说明

Node.js:

npm install logci

bower:

bower install logci

Browser:

<script src="/pathTo/logci.js"></script>

with require

var logci = require('logci');

with define

define(['logci'], function (logci) {
    //...
});

使用说明

logci(optionsObj)

配置LogCI,optionsObj是一个object,默认配置及说明如下:

optionsObj = {
    host: 'logci.com',  //string, 可选,服务器访问地址
    bucket: '',  //string, 云服务器存储空间名称,如'logci',空则不同步
    appkey: '',  //string, 云服务器访问认证,base64字符串,空或错误认证则不同步
    slient: {  //禁止打印记录
        log: false,  //false为允许log方法
        info: false,
        warn: false,
        error: false,
        globalError: false  //true为使用window.onerror屏蔽错误
    },
    report: {  //同步记录到云服务器
        log: false,  //false为不同步
        info: false,
        warn: false,
        error: false,
        globalError: false  //true为将window.onerror捕捉的错误同步
    },
    request: null  //function, 可选,服务器访问方法,已内置针对浏览器和node.js环境的request函数
}

你随时可以调用logci(optionsObj)修改配置,optionsObj将merge到原有配置,如在生产版中禁止log,info,warn打印,仅允许error:

logci({
    slient: {
        log: true,
        info: true,
        warn: true,
        error: false
    }
});

logci(function() {})

直接在logci中运行函数,如果logci使用try catch捕捉到错误,则会自动调用logci.error方法处理错误。

logci.error([data], [...])

默认行为同console.error([data], [...]),但可以通过全局配置控制它是否打印记录,是否将记录同步到云服务器。

logci.log([data], [...])

默认行为同console.log([data], [...]),但可以通过全局配置控制它是否打印记录,是否将记录同步到云服务器。

logci.info([data], [...])

默认行为同console.info([data], [...]),但可以通过全局配置控制它是否打印记录,是否将记录同步到云服务器。

logci.warn([data], [...])

默认行为同console.warn([data], [...]),但可以通过全局配置控制它是否打印记录,是否将记录同步到云服务器。

###LogCI兼容低版本浏览器或其他JavaScript环境,如果不存在console或JSON对象,会自动降级处理,而不会报错。