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

loger

v0.2.3

Published

Log your message and event

Downloads

31

Readme

loger

將事件紀錄下來,幫你的log加上色彩

簡介

這是一個npm package,用來做明顯的log顯示. 如果有需要,可以將格式化的log寫到mongodb. 個人專案上需要簡易的紀錄業務邏輯的訊息用。

安装

NPM

npm install loger --save

使用

初始化

var loger = require('loger')({
    db: 'mongodb://localhost:27017/myproject'
});

它初次被呼叫會以你傳入的參數建立一個唯一的instance.

後來再被呼叫到就只是傳回已建立的那個instance.

所以要確定程式內第一個呼叫到的地方的參數是正確的

它會把值印給你看:

Screenshot 2016-09-09 01.19.21.png

彩色的log訊息

log image

另外,所有的log方式都可以用串接的形式寫:

loger.log('a','b',{},[],null,undefined,NaN,'','e')
// 🚦 'a','b',{},[],null,undefined,NaN,'','e'

和mongodb一起使用

如果你有設定mongodb的資料庫位置

你可以用

loger.stat('action_name',json_object)

loger.statWithlog('action_name',json_object)

這種形式來把資料寫進mongodb.

它會在mongodb做一個collection, 名稱是你的action_name,

內容是你寫的json_object,並寫入時間。

我個人是用來做統計各種動作的發生狀態。

貢獻

git clone https://github.com/motephyr/loger.git

在你的專案裡面引用:

var loger = require('loger')({
    db: 'mongodb://localhost:27017/myproject'
});

試用看看:

loger.log("Loger")
loger.info("Loger")
loger.warn("Loger")
loger.debug("Loger")
loger.error("Loger")

loger image

有任何改進空間歡迎討論.

https://www.facebook.com/yijuwu