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

@panosensing/serverrecorder

v1.0.4

Published

a component of LogSystem

Downloads

2

Readme

使用說明

基本上是client端的移植版加上伺服器狀態監測 LogManager 有兩種記錄模式

  1. 手動紀錄 / 手動傳送 自行產生 Log 型別的檔案,並手動call LogManager.add, LogManager.sendAndAdd
  2. 自動記錄 / 自動傳送 使用ㄧ般的 console.log, console.warn, console.error, console.info 配合debug_mode自動使用

api - Log

Static

  • getIP : 取得用戶ip
  • getBrowser : 取得用戶瀏覽器
  • getDevice : 取得用戶裝置
  • default : 需填入以下資訊
    • app_name :
  • TYPES : Log 種類 ["general", "warn", "error", "info"]
  • RequireKey : log 會保存以下資料 ["app_name", "device", "browser", "user_name", "user_ip", "content", "type", "log_time"]
    • app_name : 應用程式名稱
    • device : 裝置名稱
    • browser : 瀏覽器名稱
    • user_name : 使用者身份別
    • user_ip : 使用者ip
    • content : 你平常打在console.log裡面的內容,這裡的格式限定為字串,並且必須標示[模組名稱] ex : console.log("[LogManager] log content")
    • type : 必須是LOG_MODE其中一種,若不為則作廢 log模式

api - LogManager

  • globalDebug : 更改模式
    • debug_mode : debug模式
    • supressAll : 是否要連同warn, error, info一起控管
  • add : 在本地新增一筆log
  • sendAndAdd : 在本地新增一筆Log也寄送給server
  • download : 下載本地端保存的log

LOG_MODE (Log)

  • TYPE_GENERAL = 0 ㄧ般
  • TYPE_WARN = 1 警告
  • TYPE_ERROR = 2 錯誤
  • TYPE_INFO = 3 通知
Log.TYPE_GENERAL
Log.TYPE_WARN
Log.TYPE_ERROR
Log.TYPE_INFO

DEBUG_MODE (LogManager)

  • MODE_SHOW_UNSEND = 1; 顯示但不寄送
  • MODE_HIDE_UNSEND = 2; 不顯示不寄送
  • MODE_SHOW_SEND = 3; 顯示也寄送
  • MODE_HIDE_SEND = 4; 不顯示但寄送
Log.MODE_SHOW_UNSEND
Log.MODE_HIDE_UNSEND
Log.MODE_SHOW_SEND
Log.MODE_HIDE_SEND

Example Code

let debug_mode = LogManager.MODE_SHOW_SEND;
// MODE_SHOW_UNSEND = 1; 顯示但不寄送
// MODE_HIDE_UNSEND = 2; 不顯示不寄送
// MODE_SHOW_SEND = 3;   顯示也寄送
// MODE_HIDE_SEND = 4;   不顯示但寄送

//設定app 名稱, 使用者名稱, debug模式, 是否封印瀏覽器開發者工具
document.LogManager = new LogManager("test_app", "guest", debug_mode );
document.LogManager.globalDebug(LogManager.MODE_SHOW_UNSEND);//更改模式

//// 手動記錄模式
//// 1. LogManager.add(new Log) 
//// 2. LogManager.sendAndAdd(new Log)

//本地端保存
document.LogManager.add(new Log({
    app_name: 'test_app',
    device: 'mobile',
    browser: 'chrome',
    user_name: "guest",
    user_ip: "128.0.0.1",
    content: "test_content",
    type: 'general',
}))

//本地端保存 & 伺服器保存
document.LogManager.sendAndAdd(new Log({
    app_name: 'test_app',
    device: 'mobile',
    browser: 'chrome',
    user_name: "guest",
    user_ip: "128.0.0.1",
    content: "[test] test_content",
    type: 'general',
}))


//// 自動記錄模式
//// 1. LogManager.add(new Log) 
//// 2. LogManager.sendAndAdd(new Log)
console.log('[test module] log content');
console.warn('[test module] log content');
console.error('[test module] log content');
console.info('[test module] log content');

//下載所有紀錄檔
document.LogManager.download();