Code Monkey home page Code Monkey logo

Comments (17)

baofengs avatar baofengs commented on June 5, 2024

可以看一下源码 src/raven.js 的第 1888 行

    if (this._globalOptions.environment === 'production') {
      wx.request({
        url: opts.url + '?' + urlencode(opts.auth),
        method: 'POST',
        header: {
          'content-type': 'text/plain;charset=UTF-8'
        },
        data: stringify(opts.data),
        success: function() {
          opts.onSuccess && opts.onSuccess();
        },
        fail: function(err) {
          opts.onError && opts.onError(err);
        }
      });
    }

所以,你应该在代码中指定 environment

options = {
    environment: '指定为production才会上报'
}

from raven-weapp.

wujunze avatar wujunze commented on June 5, 2024

已经指定 environment为production 还是没有上报信息
会自动上报console.log信息吗 还是需要手动触发 @x-bao

from raven-weapp.

baofengs avatar baofengs commented on June 5, 2024

console.log 的内容会自动捕捉,然后放到这个位置(见下图)
image

你也可以使用sentry的相关 API 手动触发:

  • Raven.captureMessage(msg, option)
  • Raven.captureBreadcrumb

详情参考 sentry 的官方文档。

from raven-weapp.

baofengs avatar baofengs commented on June 5, 2024

准确的说是:触发Raven.captureMessage(msg, option) 之后,才会把页面中的 console.log 相关的信息给捕获 & 打印来。如果你只是 console.log,在 sentry 里边是收不到任何消息的

from raven-weapp.

wujunze avatar wujunze commented on June 5, 2024

我在app.js里面 这样测试的 还是收不到上报的信息 请你帮忙看看 谢谢

import appname from './common/appname.js'
let services = require('./services/services.js');
var Raven = require('./raven/raven.min.js')

Raven.config('http://[email protected]/7', options).install()
var msg = 'test';
Raven.captureMessage(msg) 
App({
  globalData: {
    userInfo: null,
    class_id:null,  //保存当前选择的编辑类型
    counselor_user_id:'', //在顾问端时存储用户id 用于查找优惠券与兑换优惠券
  },
  onLaunch: function () {
    wx.login({
      success: function (res) {
        if (res.code) {
          // //发起网络请求
          services.request({
            url: 'services/auth/mini_program/deJsCode',
            method: 'POST',
            data: {
              code: res.code,
              appname: appname,
            },
          }).then((res) => {
            if (res.code === 0) {
              wx.setStorage({
                key: "wxLoginKey",
                data: res.wx_login_key,
              })
            }
          })

          
        } else {
          console.log('登录失败!' + res.errMsg)
        }
      }
      

    });
  
  },
})

from raven-weapp.

baofengs avatar baofengs commented on June 5, 2024

看上一条回复。
还是不行就先把 sentry 的文档看一遍吧。先把 web 的搞清楚,然后再来看小程序的。

from raven-weapp.

baofengs avatar baofengs commented on June 5, 2024

看上一条回复。
还是不行就先把 sentry 的文档看一遍吧。先把 web 的搞清楚,然后再来看小程序的。

from raven-weapp.

wujunze avatar wujunze commented on June 5, 2024

@x-bao 已经用了很久时间的Web版了 都正常
小程序这个收不到上报信息 你怎么配置的 帮忙看看

from raven-weapp.

baofengs avatar baofengs commented on June 5, 2024

文档怎么写,我就是怎么做的。多试试

from raven-weapp.

wujunze avatar wujunze commented on June 5, 2024

OK 你那边使用正常? @x-bao

from raven-weapp.

baofengs avatar baofengs commented on June 5, 2024

一切正常,做了一点小优化。提了 pull request,但是没有人理...

from raven-weapp.

qinghua5453 avatar qinghua5453 commented on June 5, 2024

可以看一下源码 src/raven.js 的第 1888 行

    if (this._globalOptions.environment === 'production') {
      wx.request({
        url: opts.url + '?' + urlencode(opts.auth),
        method: 'POST',
        header: {
          'content-type': 'text/plain;charset=UTF-8'
        },
        data: stringify(opts.data),
        success: function() {
          opts.onSuccess && opts.onSuccess();
        },
        fail: function(err) {
          opts.onError && opts.onError(err);
        }
      });
    }

所以,你应该在代码中指定 environment

options = {
    environment: '指定为production才会上报'
}

请问您小程序有用什么开源的框架吗?
我用的mpvue,正常引入npm run dev 或者 npm run build 均报错

from raven-weapp.

qinghua5453 avatar qinghua5453 commented on June 5, 2024

一切正常,做了一点小优化。提了 pull request,但是没有人理...

执行npm run dev 出现这个报错
This relative module was not found:

  • ../utils/raven-weapp/build/raven.min.js in ./node_modules/mpvue-entry/dist/cardReserve.js, ./node_modules/mpvue-entry/dist/demoSlide.js and 32 others

from raven-weapp.

qinghua5453 avatar qinghua5453 commented on June 5, 2024

已经指定 environment为production 还是没有上报信息
会自动上报console.log信息吗 还是需要手动触发 @x-bao

请问你最后是捕获到了吗?

from raven-weapp.

wujunze avatar wujunze commented on June 5, 2024

没有捕获到

from raven-weapp.

wujunze avatar wujunze commented on June 5, 2024

已经解决了

from raven-weapp.

wujunze avatar wujunze commented on June 5, 2024

Thanks @qinghua5453

from raven-weapp.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.