
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
@loyalvalleycapital/monitor
Advanced tools
如果通过一些其他工具配置了安装源,那么
--registry参数可以忽略
# npm
npm install @loyalvalleycapital/monitor --registry=xxxxx
# yarn
yarn add @loyalvalleycapital/monitor --registry=xxxx
目前打出 2 个版本的 js,一个包含
UserAgent库的,一个不包含的(为了减少包体积,概况可以减少33kb),默认指向不包括的UserAgent。如果需要引入包含UserAgent的 js,需要配置下 webpack 别名:
{
alias: {
// ...other alias
monitorsdk: 'monitorsdk/dist/monitorsdk-web.js',
}
}
import monitor, { setCustomError } from ' @loyalvalleycapital/monitor'
monitor.trackEv(...)
setCustomError(err, {code: 'xxx', custom: {}})
用法跟之前相同,因为抽取成 npm 包的形式复用,所有有些参数必须通过外部传递进来。 以下几点需要注意:
Promise捕获,希望每个项目有不同的错误码,所以在初始的时候monitor.init(),传入一个projectErrCode参数:monitor.init({
projectErrCode: 'ERR020000',
其他选项,
// ...
})
wrapperRequest这个 redux 中间件里把请求的错误都抛出了,所以在使用的时候,通过setCustomError把相关的一些错误信息配置到error对象上,方便全局统一捕获import { setCustomError } from "@loyalvalleycapital/monitor";
.catch(error => {
next({
type,
payload: {
error,
loading: false,
status: 'failure',
params,
},
});
if (errorCallback) errorCallback();
// 这里
setCustomError(error, {
code: 'ERR02000002',
custom: payload
})
return Promise.reject(error);
)
上面的错误码只是示例,具体的项目可以自定义,定义的时候可以在这里维护下
FAQs
A log lib for RN and web project
The npm package @loyalvalleycapital/monitor receives a total of 600 weekly downloads. As such, @loyalvalleycapital/monitor popularity was classified as not popular.
We found that @loyalvalleycapital/monitor demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.