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 🙏

© 2026 – Pkg Stats / Ryan Hefner

xlog.js

v1.1.0

Published

js log info collection trace

Readme

XLog

XLog is a log management by PROD or DEV,

  • IN PROD Mode, just collect the log info, donot print in console
  • IN DEV Mode, console info will be show real time
  • IN CLOSE Mode, console will be not effected

Feature

  • log ui
  • log level
  • log group and sort by time
  • log find and filter
  • log show by real-time(DEV) or manual call at console(PROD)
  • error catch auto

Example

Classes

Members

XLog

Kind: global class

new XLog(opt)

eg: var xLog = new XLog(opt)

create a XLog instance

| Param | Type | Default | Description | | --- | --- | --- | --- | | opt | object | | arguments object | | [opt.level] | number | 3 | log level LOG.LEVEL below level not show auto or manual, but set() to change LEVEL | | [opt.mode] | string | "DEV" | 'CLOSE' OR 'DEV' OR 'PROD' LOG.MODE DEV mode show log realtime, PROD mode show log manual by sh ow() method CLOSE will be all Xlog.js and error monitor | | [opt.send] | function | function(){} | if u need to send log to remote, u need to define send function |

Collection Log Data(pls see: run index.html or visit test.js)


log.emergency('this is show by log.emergency')
log.alert('this is show by log.alert')
log.critical('this is show by log.critical')
log.error('this is show by log.error')
log.warn('this is show by log.warn')
log.notice('this is show by log.notice')
log.info('this is show by log.info')
log.log('this is show by log.log')

log.add(0, 'this is a 0 by log.add')
log.add(1, 'this is a 1 by log.add')
log.add(2, 'this is a 2 by log.add')
log.add(3, 'this is a 3 by log.add')
log.add(4, 'this is a 4 by log.add')
log.add(5, 'this is a 5 by log.add')
log.add(6, 'this is a 6 by log.add')
log.add(7, 'this is a 7 by log.add')

setTimeout(function () { log.add(5, 'this is a info by async') }, 200)
log.catch(test.testError)('test show')

//add try catch for all test2 modules function and test.start function
log.catchModule(test2);
log.catch(test.start)()

xLog.init()

init reset XLog data

Kind: instance method of XLog

xLog.size() ⇒ obejct

Get the size of all local log

Kind: instance method of XLog Returns: obejct - - Object {len: 2827, byte: 2903, size: 2.8349609375}

xLog.get(level) ⇒ object

Get the log data by level

Kind: instance method of XLog Returns: object - XLog.data

| Param | Type | Description | | --- | --- | --- | | level | number | string | the level Number or Name String of log item |

xLog.set(level)

set log level, just show log below level number

Kind: instance method of XLog

| Param | Type | Description | | --- | --- | --- | | level | number | string | the level Number or Name String of log item |

xLog.show(level, [sort])

Show All XLogs 显示所有日志信息(受限不能大于XLOG.level), 传入level则显示level: 0~number, level name则仅显示name 对应的level

Kind: instance method of XLog

| Param | Type | Default | Description | | --- | --- | --- | --- | | level | number | string | | the level Number or Name String of log item | | [sort] | string | "'time'" | time or group- show log by time sorted |

Example

XLOG.show()  print level 0~3 [this.level=3]
XLOG.show(0)  print level 0
XLOG.show(1)  print level 0-1
XLOG.show(n)  print level 0-n, n max is 7
XLOG.show('EMERGENCY') optional ['ALERT','CRITICAL','ERROR','WARN','NOTICE','INFO','LOG'] print corresponding level

xLog.find(str, level)

Show and Print the log info by str or level

Kind: instance method of XLog

| Param | Type | Description | | --- | --- | --- | | str | string | find log by str, find log by console, level,stack info, etc... | | level | number | string | the level Number or Name String of log item find, if null no level limited |

xLog.reset(level)

reset log data 重置所有日志内容

Kind: instance method of XLog

| Param | Type | Description | | --- | --- | --- | | level | number | string | the level Number or Name String of log item |

xLog.catch(f) ⇒ function

decorate function f with try catch wrapper

Kind: instance method of XLog Returns: function - f - return try catch wrappered f

| Param | Type | | --- | --- | | f | function |

xLog.catchModule(m)

decorate every function of module m with try catch wrapper

Kind: instance method of XLog

| Param | Type | Description | | --- | --- | --- | | m | object | module with functions |

XLog.LOG : enum

XLog.LOG.LEVELHE LOG

Kind: static enum of XLog Example

0: 'EMERGENCY',  //system unusable
1: 'ALERT',      //immediate action required
2: 'CRITICAL',   //condition critical
3: 'ERROR',      //condition error
4: 'WARN',       //condition warning
5: 'NOTICE',     //condition normal, but significant
6: 'INFO',       //a purely informational message
7: 'LOG'         // LOG or debugging information

LOG

XLog - https://github.com/ccjoe/XLog

Kind: global variable

Licensed under the MIT license.