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

seastar-log

v0.1.2

Published

description: replace the default console to log

Downloads

3

Readme

seastar-log

扩展node.js原生的console,主要加入了时间、调用函数、和调用文件名的属性输出

preface

  • 代码中很多地方都用到了node.js原生的console进行日志的记录,但是在进行业务跟踪和排查时,比较重要是时间等相关信息无法输出。
  • 使用其他的日志记录组件比较重,同时要更改代码,有一定的工作量
  • 使用seastar-log比较轻量级,而且不需要更改日志记录的代码

Installation

** 要求node的最低版本为:0.11.x **

  1. 将seastar-log.js放入自己的工程目录,然后用相对路径引入
  2. 将seastar-log.js文件放入node_modules下
  3. 通过npm安装
    npm install seastar-log
       

Example

使用方法与node.js原生的console大致相同

初始化

在文件的入口出加入以下代码:

var seastar_console = require('seastar-log');

delete global.console;
global.console = seastar_console;

输出调用方法的文件名

文件名 : hello.js

function print(){
	console.log('the console for seastar!!!',__filename);
}
print();

显示结果 :

[2015-5-24 15:23:47] [hello.js] [print] : the console for seastar!!!

[日期时间]  [调用文件名]  [调用方法名]  要输出的日志内容

只输出日志和调用方法名

文件名 : hello.js

function print(){
	console.log('the console for seastar!!!');
}
print();

显示结果 :

[2015-5-24 15:23:47] [unkown] [print] : the console for seastar!!!

[日期时间]  [默认为unkown]  [调用方法名]  要输出的日志内容