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

kaiheila-web-log

v1.8.0

Published

日志收集上报工具

Downloads

39

Readme

说明

日志收集上报工具 dist 文件夹不要删

如何安装

  • npm 方式:
    • npm i kaiheila-web-log
  • script 标签方式:

如何使用

  • npm 方式在项目入口引用:
    • import LoggerSdk from 'kaiheila-web-log';
    • let loggerSdk = new LoggerSdk();
    • //此处建议将对象挂载成全局对象
    • window.loggerSdk = loggerSdk;
  • script 标签方式:
    • 不需要做引用操作,loggerSdk 会自动挂在 window 上 window.loggerSdk

window.loggerSdk.register(request, time): 注册方法,挂载轮询,传递网络请求方法

  • 参数:

    • {request} 项目中的网络请求对象
    • {time} 轮询上传间隔,默认 5 秒,传毫秒
    • {language} 当前语言,默认 zh
  • demo:

    window.loggerSdk.register(request,10000)

window.loggerSdk.writeLog(data,type): 记录日志方法

  • 参数:

    • {data} 要记录的单条数据,可以传 object 或 json
    • {type} 1:sdk 如果是 sdk 的日志,实时上报
  • demo:

    window.loggerSdk.writeLog({id:1,...})
    or
    window.loggerSdk.writeLog("{"id":1,...}")

window.loggerSdk.openLogLoop(): 轮询上传方法,不支持直接调用

打包

npm run build即可打包压缩混淆。 npm publish发布到 npm

更新记录

  • v1.7.0 增加手动上传埋点功能,供测试使用
  • v1.6.0 增加 version 外层传入判定
  • v1.5.0 openLogLoop 方法 上传时增加字符串长度大于 1000 判定,减少请求次数
  • v1.3.0 writeLog 方法 增加 type,如果是 sdk 的日志,直接上报不用等
  • v1.2.0 增加计时器时间到 20 分钟,上传和写入的数据改为纯 json 字符串,不做转换
  • v1.1.5 增加计时器时间到 10 分钟,每次上传检测,如果小于 100 条则不上传
  • v1.1.4 更改计时器使用方式
  • v1.1.3 去掉 log
  • v1.1.2 新增网络请求不传时的网络请求初始化
  • v1.1.1 优化 console
  • v1.1.0 增加 script 标签引用打包适配
  • v1.0.1 增加使用说明
  • v1.0.0 初始化版本