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

@omni-log/log-mini

v0.1.2

Published

微信小程序、支付宝小程序日志 SDK。

Readme

@omni-log/log-mini

微信小程序、支付宝小程序日志 SDK。

自动采集:页面生命周期(onLaunch / onShow / onLoad 等)、HTTP 请求(成功 / 失败 / 超时)、JS 错误、未捕获的 Promise rejection、用户点击、showToast、navigateTo 等常用 API 调用。

安装

npm install @omni-log/log-mini

快速开始

微信小程序

app.js 最顶部引入并初始化,必须在 App() 之前调用

import log from '@omni-log/log-mini'

log.init({
  appId: 'your-app-id', // 必填,日志服务接入标识
  domain: 'https://your-log-server.com/log/pushLog', // 必填,日志上报地址
  isProd: true, // 是否为生产环境(false 时不上报)
  checkDev: true, // 自动检测微信开发者工具并禁用上报
  params: {
    version: '1.0.0' // 附加到每条日志的自定义字段
  }
})

支付宝小程序

import log from '@omni-log/log-mini'
// API 完全相同,SDK 会自动识别运行环境
log.init({ ... })

uni-app

import log from '@omni-log/log-mini'

log.init({
  appId: 'your-app-id',
  domain: 'https://your-log-server.com/log/pushLog',
  framework: 'uniapp' // 可选,默认 uniapp;也支持 'taro'
})

初始化配置

interface InitOptions {
  appId: string | number // 日志服务接入标识(必填)
  domain?: string // 上报地址(必填,除非 isDebug 为 true)
  isProd?: boolean // 默认 true;false 时不上报任何数据
  checkDev?: boolean // 默认 true;自动检测 IDE 环境并禁用上报
  isDebug?: boolean // true 时上报至本地 127.0.0.1:7001(开发用)
  failureRetry?: number // 上报失败后的重试次数,默认 1
  params?: Params // 附加到每条日志的公共字段,可为对象或函数
  config?: Config // 细粒度控制哪些事件上报(见下方 Config)
  framework?: 'uniapp' | 'taro' // 框架类型,影响点击事件的函数名提取
  xcxCiUrl?: string // CI 工具专用上报地址
}

细粒度控制(Config)

log.setConfig({
  slientLog: false, // true → 完全关闭上报
  silentHttp: false, // true 或 RegExp[] → 屏蔽 HTTP 上报(正则黑名单)
  silentClick: false, // true → 不上报点击事件
  silentElementError: true, // true → 不上报资源加载错误
  silentHttpFineControl: false, // true → 仅上报显式带 reportLog: true 的请求
  onlyReportErrors: true // true → 只有 Error 类型才上报到 eventType 6
})

公共参数

每条日志都会附加公共参数,支持对象或动态函数:

// 静态对象
log.logCore.setParams({ userId: '123', version: '2.0.0' })

// 动态函数(每次打日志时执行)
log.logCore.setParams((logItem, currentParams) => ({
  userId: getApp().globalData.userId
}))

手动上报

// 上报自定义事件(eventType 12)
log.pushLog('12', 'purchase_success', { orderId: 'xxx', amount: 99 })

// 页面进入(eventType 3)
log.pushLog('3', '/pages/home/index', { query: {} })

Vue 错误集成

// Vue 2
app.use(log.vue2Plugin)

// Vue 3
app.use(log.vue3Plugin)

监听指定 API

// 额外监听某些小程序 API 的调用结果
log.warpUserApi(['requestPayment', 'login'], {
  login(logItem, req) {
    logItem.eventType = '9'
  }
})

日志事件类型参考

| eventType | 含义 | | --------- | ---------------------- | | 1 | App onLaunch | | 2 | App onShow | | 3 | Page onShow | | 4 | Page onHide | | 5 | Page onLoad | | 6 | JS 错误 | | 7 | HTTP 请求 | | 8 | 点击事件 | | 9 | 小程序 API 调用 | | 10 | 重要函数(下拉刷新等) | | 11 | showToast | | 12 | 自定义事件 | | 14 | 设备信息 | | 16 | 未分类错误 | | 28 | console 输出 |