qywechat-notifier 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6ef2a402481e5dc39050d1da78d3fa56baf1211f5ec24156cddaf1882dfd7035
4
- data.tar.gz: 273bbf02d2e0aee4970ea5bda91185e23ed16dd7a731bbcf9515f378bc826e61
3
+ metadata.gz: 21e532356b8339f4ea1b4903da9e171883c1c3ea8815bed3d3a07707ef936fad
4
+ data.tar.gz: 556aab2416a4c2cfc536aae3e0301b633121fad63820b04c5dc555f2b86f6c24
5
5
  SHA512:
6
- metadata.gz: 5a13cd1b0ea24826c8818b25578b85cdb8770f7a7c31a1556071af027f23ffacb650cc1457f18e8b674d766fb2bb46c8d6a9b904661f7d37c5d4865b0d94334f
7
- data.tar.gz: 8e428d6d0c8de5b05dd4b05b5fbe1cf0dee1e83259602fdac0dd7d8e6ee23d60eb80099e5039762b010a8c62d238e9b7f2b4c977d6001ab237db913178b98945
6
+ metadata.gz: ab7c84df7f9554aeea15e7ddbcf92f6240eb9b134978acca6fadfbcb2f6cce545cf0fe95c54703bd01f0b165f15c40f6d49a3859747fe450e8d910d94c076d66
7
+ data.tar.gz: 8a46820b0897a3af7f347aeb1901713c813edce4ab92cd1123d48d205257b344a73d82ca327e4454803fd2e40b50b2feedd128a42f2a65d1b7588802bcdc265d
data/README.md CHANGED
@@ -23,17 +23,6 @@ And then execute:
23
23
 
24
24
  ## Usage
25
25
 
26
- ### 创建群聊会话
27
-
28
- 系统提供了 Rake 命令,帮助快速创建一个会话
29
-
30
- ```bash
31
- $ rails create_groupchat
32
- ```
33
-
34
- 请按照引导创建群聊,创建成功后系统会发送一条消息,初始至少需要一位群主和一位群员。后续可手动去企业微信APP中添加其他成员。
35
-
36
- 记录好 CHATID。
37
26
 
38
27
  ### 配置
39
28
 
@@ -54,7 +43,19 @@ CORPID: 参见[说明](https://work.weixin.qq.com/api/doc#90000/90135/90665)
54
43
 
55
44
  CORPSECRET: 参见[说明](https://work.weixin.qq.com/api/doc#90000/90135/90665)
56
45
 
57
- CHATID: 上面用 Rake 命令创建的群聊ID,参见[说明](https://work.weixin.qq.com/api/doc#90000/90135/90245)
46
+ CHATID: 先配置为空,下面更新为 Rake 命令创建的群聊ID,参见[说明](https://work.weixin.qq.com/api/doc#90000/90135/90245)
47
+
48
+ ### 创建群聊会话
49
+
50
+ 系统提供了 Rake 命令,帮助快速创建一个会话
51
+
52
+ ```bash
53
+ $ rails create_groupchat
54
+ ```
55
+
56
+ 请按照引导创建群聊,创建成功后系统会发送一条消息,初始至少需要一位群主和一位群员。后续可手动去企业微信APP中添加其他成员。
57
+
58
+ 别忘了更新第一步的配置中的 CHATID。
58
59
 
59
60
  ### 配置 exception_notification,启用插件
60
61
 
@@ -66,10 +67,12 @@ require 'exception_notification/sidekiq'
66
67
  ExceptionNotification.configure do |config|
67
68
  ...
68
69
  ...
69
- config.add_notifier :qy_wechat, {}
70
+ config.add_notifier :qy_wechat, { filter_exception: true }
70
71
  end
71
72
  ```
72
73
 
74
+ 选项 `filter_exception` 控制是否过滤Rails内部异常堆栈,只显示应用自身堆栈,默认为 `true`。
75
+
73
76
  ### 完成
74
77
 
75
78
  到此,所有 Rails 应用异常都可以发送到群聊之中了。
@@ -94,6 +97,20 @@ class ApplicationController < ActionController::Base
94
97
  end
95
98
  ```
96
99
 
100
+ ## 版本记录
101
+
102
+ * 0.4.0
103
+
104
+ 支持 `filter_exception` 选项
105
+
106
+ * 0.3.0
107
+
108
+ 修复已知bug
109
+
110
+ * 0.1.0
111
+
112
+ 发布内测版
113
+
97
114
  ## Development
98
115
 
99
116
  After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -102,7 +119,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
102
119
 
103
120
  ## Contributing
104
121
 
105
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/qywechat-notifier. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
122
+ Bug reports and pull requests are welcome on GitHub at https://github.com/dao42/qywechat-notifier. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
106
123
 
107
124
  ## License
108
125
 
@@ -110,4 +127,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
110
127
 
111
128
  ## Code of Conduct
112
129
 
113
- Everyone interacting in the Qywechat::Notifier project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/qywechat-notifier/blob/master/CODE_OF_CONDUCT.md).
130
+ Everyone interacting in the Qywechat::Notifier project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/dao42/qywechat-notifier/blob/master/CODE_OF_CONDUCT.md).
@@ -5,6 +5,8 @@ module ExceptionNotifier
5
5
  class QyWechatNotifier < BaseNotifier
6
6
  def initialize(options)
7
7
  super
8
+ @filter_exception = options[:filter_exception]
9
+ @filter_exception = true if @filter_exception.nil?
8
10
  end
9
11
 
10
12
  def call(exception, options={})
@@ -21,15 +23,21 @@ module ExceptionNotifier
21
23
  timestamp: Time.current.strftime('%Y-%m-%d %H:%M:%S')
22
24
  }
23
25
 
24
- message = <<-EOF
25
- Exception>>> #{exception.class.to_s}: #{exception.message.inspect}
26
- URL>>> #{request_items[:http_method]}: #{request_items[:url]}( from: #{request_items[:ip_address]} )
27
- PARAM>>> #{request_items[:parameters]}
28
- Agent>>> #{request.filtered_env['HTTP_USER_AGENT']}
29
- Data>>> #{env && env['exception_notifier.exception_data']}
30
- ------------
31
- Backtrace( 5 below )>>>\n
32
- #{exception.backtrace[0..4].join("\n")}
26
+ bt_msg = ''
27
+ if @filter_exception
28
+ bt_msg = %Q{Backtrace( Application Only, 5 below )>>>\n#{Rails.backtrace_cleaner.filter(exception.backtrace)[0..4].join("\n")}"}
29
+ else
30
+ bt_msg = %Q{Backtrace( 5 below )>>>\n#{exception.backtrace[0..4].join("\n")}}
31
+ end
32
+
33
+ message = <<~EOF
34
+ Exception>>> #{exception.class.to_s}: #{exception.message.inspect}
35
+ URL>>> #{request_items[:http_method]}: #{request_items[:url]}( from: #{request_items[:ip_address]} )
36
+ PARAM>>> #{request_items[:parameters]}
37
+ Agent>>> #{request.filtered_env['HTTP_USER_AGENT']}
38
+ Data>>> #{env && env['exception_notifier.exception_data']}
39
+ ------------
40
+ #{bt_msg}
33
41
  EOF
34
42
 
35
43
  Qywechat::Notifier::QyAPI.api_message.send_groupchat(message)
@@ -1,5 +1,5 @@
1
1
  module Qywechat
2
2
  module Notifier
3
- VERSION = "0.3.0"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qywechat-notifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - yunyi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-24 00:00:00.000000000 Z
11
+ date: 2019-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler