fyipe 3.0.11964 → 3.0.12021.pre.qa
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +168 -0
- data/lib/fyipe.rb +2 -0
- data/lib/fyipe/version.rb +1 -1
- data/lib/fyipeTracker.rb +2 -2
- data/spec/fyipe_logger_spec.rb +10 -12
- data/spec/fyipe_tracker_spec.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 916c9d6840ff3cff9437543fd36b762d37abbc8c862a5adde5224192f50a76c8
|
4
|
+
data.tar.gz: 8d464b3df7ff3c92517100df1d202cbbcaf6dcb4ee49bd12f6cec1e713d3da85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2283dfdf47042eeb95141d7b12b0873d409f7c20293d6acf55f52378dc2752900dc7ca793c6e9c03abe3728a7cd63e33e249db885265a71cb6545739c90da65b
|
7
|
+
data.tar.gz: a78b7b7378a2b61e2b95f78ae147587875d11678ca9ecc36742bfd77d76e9d0800c8b64ff1b57b74710cabe3c061f3b0aad263f37fa268437ac2f790e8f223db
|
data/README.md
CHANGED
@@ -61,6 +61,72 @@ response = logger.log(item, tags)
|
|
61
61
|
puts response
|
62
62
|
```
|
63
63
|
|
64
|
+
## Basic Usage for Tracking
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
require 'fyipe'
|
68
|
+
|
69
|
+
# set up tracking configurations
|
70
|
+
options = {
|
71
|
+
"maxTimeline": 50,
|
72
|
+
"captureCodeSnippet": true
|
73
|
+
}
|
74
|
+
|
75
|
+
# constructor
|
76
|
+
tracker = FyipeLogger.new(
|
77
|
+
'API_URL', # https://fyipe.com/api
|
78
|
+
'ERROR_TRACKER_ID',
|
79
|
+
'ERROR_TRACKER_KEY',
|
80
|
+
options # optional
|
81
|
+
)
|
82
|
+
|
83
|
+
# capturing a timeline manually
|
84
|
+
timelineContent = {}
|
85
|
+
|
86
|
+
timelineContent["account"] = "debit"
|
87
|
+
timelineContent["amount"] = "6000.00"
|
88
|
+
timelineContent["userId"] = 471
|
89
|
+
tracker.addToTimeline('payment', timelineContent, 'info')
|
90
|
+
|
91
|
+
# setting custom tags
|
92
|
+
tracker.setTag('category', 'QA Tester') # a single tag
|
93
|
+
|
94
|
+
# multiple tags
|
95
|
+
tags = []
|
96
|
+
|
97
|
+
# create two tags
|
98
|
+
tagOne = {}
|
99
|
+
tagOne["key"] = 'type'
|
100
|
+
tagOne["value"] = 'notification'
|
101
|
+
tagTwo = {}
|
102
|
+
tagTwo["key"] = 'location'
|
103
|
+
tagTwo["value"] = 'Oslo'
|
104
|
+
|
105
|
+
# add the two items to the array
|
106
|
+
tags = [tagOne, tagTwo]
|
107
|
+
|
108
|
+
# setting the array of tags
|
109
|
+
tracker.setTags(tags)
|
110
|
+
|
111
|
+
|
112
|
+
# all error exception captured are sent to your fyipe dashboard
|
113
|
+
|
114
|
+
# capturing errors in a begin and rescue
|
115
|
+
begin
|
116
|
+
# some code that might fail
|
117
|
+
result = 5/0 # Should throw a division by zero error
|
118
|
+
rescue => ex
|
119
|
+
tracker.captureException(ex)
|
120
|
+
end
|
121
|
+
|
122
|
+
# capturing errors using the message signature
|
123
|
+
tracker.captureMessage('some error text')
|
124
|
+
|
125
|
+
# capturing errors authomatically
|
126
|
+
NonExistingMethod() # calling this will trigger an error and its sent to your fyipe dashboard
|
127
|
+
|
128
|
+
```
|
129
|
+
|
64
130
|
## API Documentation
|
65
131
|
|
66
132
|
Main API to send logs to the server.
|
@@ -71,11 +137,20 @@ Main API to send logs to the server.
|
|
71
137
|
- [Installation](#installation)
|
72
138
|
- [Gem Install](#gem-install)
|
73
139
|
- [Basic Usage for Logging](#basic-usage-for-logging)
|
140
|
+
- [Basic Usage for Tracking](#basic-usage-for-tracking)
|
74
141
|
- [API Documentation](#api-documentation)
|
75
142
|
- [FyipeLogger.new(apiUrl, applicationId, applicationKey)](#fyipeloggernewapiurl-applicationid-applicationkey)
|
76
143
|
- [logger.log(log, \tags)](#loggerloglog-tags)
|
77
144
|
- [logger.warning(warning, \tags)](#loggerwarningwarning-tags)
|
78
145
|
- [logger.error(error, \tags)](#loggererrorerror-tags)
|
146
|
+
- [FyipeTracker.new(apiUrl, errorTrackerId, errorTrackerKey)](#fyipetrackernewapiurl-errortrackerid-errortrackerkey)
|
147
|
+
- [options](#options)
|
148
|
+
- [tracker.setTag(key, value)](#trackersettagkey-value)
|
149
|
+
- [tracker.setTags([{key, value}])](#trackersettagskey-value)
|
150
|
+
- [tracker.setFingerprint(fingerprint)](#trackersetfingerprintfingerprint)
|
151
|
+
- [tracker.addToTimeline(category, content, type)](#trackeraddtotimelinecategory-content-type)
|
152
|
+
- [tracker.captureMessage(message)](#trackercapturemessagemessage)
|
153
|
+
- [tracker.captureException(error)](#trackercaptureexceptionerror)
|
79
154
|
- [Contribution](#contribution)
|
80
155
|
|
81
156
|
<a name="logger_api--logger"></a>
|
@@ -129,6 +204,99 @@ Logs a request of type `error` to the server.
|
|
129
204
|
| \error | <code>string</code> \| <code>Object</code> | The content to the logged on the server. |
|
130
205
|
| \tags | <code>string</code> \| <code>Array</code> | The tag(s) to be attached to the logged item on the server. |
|
131
206
|
|
207
|
+
<a name="tracker_api--tracker"></a>
|
208
|
+
|
209
|
+
### FyipeTracker.new(apiUrl, errorTrackerId, errorTrackerKey)
|
210
|
+
|
211
|
+
Create a constructor from the class, which will be used to track errors sent to the server.
|
212
|
+
|
213
|
+
**Kind**: Constructor
|
214
|
+
**Returns**: <code>null</code>
|
215
|
+
|
216
|
+
| Param | Type | Description |
|
217
|
+
| --------------- | ------------------- | ------------------------------------------- |
|
218
|
+
| apiUrl | <code>string</code> | The Server URL. |
|
219
|
+
| errorTrackerId | <code>string</code> | The Error Tracker ID. |
|
220
|
+
| errorTrackerKey | <code>string</code> | The Error Tracker Key. |
|
221
|
+
| option | <code>object</code> | The options to be considred by the tracker. |
|
222
|
+
|
223
|
+
#### options
|
224
|
+
|
225
|
+
| Param | Type | Description |
|
226
|
+
| ------------------ | -------------------- | ----------------------------------------------------------------------------------------------------- |
|
227
|
+
| maxTimeline | <code>int</code> | The total amount of timeline that should be captured, defaults to 5 |
|
228
|
+
| captureCodeSnippet | <code>boolean</code> | When set as `true` stack traces are automatically attached to all error sent to your fyipe dashboard. |
|
229
|
+
|
230
|
+
#### tracker.setTag(key, value)
|
231
|
+
|
232
|
+
Set tag for the error to be sent to the server.
|
233
|
+
|
234
|
+
**Kind**: method of [<code>FyipeTracker</code>](#tracker_api--tracker)
|
235
|
+
**Returns**: <code>null</code>
|
236
|
+
|
237
|
+
| Param | Type | Description |
|
238
|
+
| ----- | ------------------- | ---------------------- |
|
239
|
+
| key | <code>string</code> | The key for the tag. |
|
240
|
+
| value | <code>string</code> | The value for the tag. |
|
241
|
+
|
242
|
+
#### tracker.setTags([{key, value}])
|
243
|
+
|
244
|
+
Set multiple tags for the error to be sent to the server. Takes in a list
|
245
|
+
|
246
|
+
**Kind**: method of [<code>FyipeTracker</code>](#tracker_api--tracker)
|
247
|
+
**Returns**: <code>null</code>
|
248
|
+
|
249
|
+
| Param | Type | Description |
|
250
|
+
| ----- | ------------------- | ---------------------- |
|
251
|
+
| key | <code>string</code> | The key for the tag. |
|
252
|
+
| value | <code>string</code> | The value for the tag. |
|
253
|
+
|
254
|
+
#### tracker.setFingerprint(fingerprint)
|
255
|
+
|
256
|
+
Set fingerprint for the next error to be captured.
|
257
|
+
|
258
|
+
**Kind**: method of [<code>FyipeTracker</code>](#tracker_api--tracker)
|
259
|
+
**Returns**: <code>null</code>
|
260
|
+
|
261
|
+
| Param | Type | Description |
|
262
|
+
| ----------- | --------------------------------------------------- | ------------------------------------------------------------- |
|
263
|
+
| fingerprint | <code>string</code> \| <code>list of strings</code> | The set of string used to group error messages on the server. |
|
264
|
+
|
265
|
+
#### tracker.addToTimeline(category, content, type)
|
266
|
+
|
267
|
+
Add a custom timeline element to the next error to be sent to the server
|
268
|
+
|
269
|
+
**Kind**: method of [<code>FyipeTracker</code>](#tracker_api--tracker)
|
270
|
+
**Returns**: <code>null</code>
|
271
|
+
|
272
|
+
| Param | Type | Description |
|
273
|
+
| -------- | ------------------------------------------ | ----------------------------------- |
|
274
|
+
| category | <code>string</code> | The category of the timeline event. |
|
275
|
+
| content | <code>string</code> \| <code>object</code> | The content of the timeline event. |
|
276
|
+
| type | <code>string</code> | The type of timeline event. |
|
277
|
+
|
278
|
+
#### tracker.captureMessage(message)
|
279
|
+
|
280
|
+
Capture a custom error message to be sent to the server
|
281
|
+
|
282
|
+
**Kind**: method of [<code>FyipeTracker</code>](#tracker_api--tracker)
|
283
|
+
**Returns**: <code>Promise</code>
|
284
|
+
|
285
|
+
| Param | Type | Description |
|
286
|
+
| ------- | ------------------- | ------------------------------------- |
|
287
|
+
| message | <code>string</code> | The message to be sent to the server. |
|
288
|
+
|
289
|
+
#### tracker.captureException(error)
|
290
|
+
|
291
|
+
Capture a custom error object to be sent to the server
|
292
|
+
|
293
|
+
**Kind**: method of [<code>FyipeTracker</code>](#tracker_api--tracker)
|
294
|
+
**Returns**: <code>Promise</code>
|
295
|
+
|
296
|
+
| Param | Type | Description |
|
297
|
+
| ----- | ----------------------------- | ------------------------------------------ |
|
298
|
+
| error | <code>Exception object</code> | The Error Object to be sent to the server. |
|
299
|
+
|
132
300
|
## Contribution
|
133
301
|
|
134
302
|
- Clone repository
|
data/lib/fyipe.rb
ADDED
data/lib/fyipe/version.rb
CHANGED
data/lib/fyipeTracker.rb
CHANGED
@@ -4,7 +4,7 @@ require_relative 'fyipe/fyipeTransport'
|
|
4
4
|
require File.expand_path('./fyipe/version', __dir__)
|
5
5
|
|
6
6
|
class FyipeTracker
|
7
|
-
#
|
7
|
+
# FyipeTracker constructor.
|
8
8
|
# @param string apiUrl
|
9
9
|
# @param string errorTrackerId
|
10
10
|
# @param string errorTrackerKey
|
@@ -27,7 +27,7 @@ class FyipeTracker
|
|
27
27
|
setEventId()
|
28
28
|
@listenerObj = FyipeListener.new(getEventId(), @options)
|
29
29
|
@apiTransport = FyipeTransport.new(@apiUrl)
|
30
|
-
|
30
|
+
setUpExceptionHandlerListener()
|
31
31
|
end
|
32
32
|
|
33
33
|
def setApiUrl(apiUrl)
|
data/spec/fyipe_logger_spec.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# spec/fyipe_logger_spec.rb
|
2
|
-
require_relative '../lib/
|
2
|
+
require_relative '../lib/fyipe'
|
3
3
|
require_relative 'helper'
|
4
4
|
|
5
5
|
RSpec.configure do |config|
|
@@ -55,7 +55,7 @@ RSpec.describe FyipeLogger do
|
|
55
55
|
logger = FyipeLogger.new($apiUrl, $applicationLog["_id"], $applicationLog["key"])
|
56
56
|
response = logger.log(log)
|
57
57
|
expect(response['content']).to eql log
|
58
|
-
expect(response['content']
|
58
|
+
expect(response['content']).to be_an_instance_of(String)
|
59
59
|
expect(response['type']).to eql "info"
|
60
60
|
end
|
61
61
|
it 'test_valid_object_content_of_type_info_is_logged' do
|
@@ -66,7 +66,7 @@ RSpec.describe FyipeLogger do
|
|
66
66
|
logger = FyipeLogger.new($apiUrl, $applicationLog["_id"], $applicationLog["key"])
|
67
67
|
response = logger.log(log)
|
68
68
|
expect(response['content']["location"]).to eql log["location"]
|
69
|
-
expect(response['content']
|
69
|
+
expect(response['content']).to be_an_instance_of(Hash)
|
70
70
|
expect(response['type']).to eql "info"
|
71
71
|
end
|
72
72
|
it 'test_valid_string_content_of_type_error_is_logged' do
|
@@ -74,7 +74,7 @@ RSpec.describe FyipeLogger do
|
|
74
74
|
logger = FyipeLogger.new($apiUrl, $applicationLog["_id"], $applicationLog["key"])
|
75
75
|
response = logger.error(log)
|
76
76
|
expect(response['content']).to eql log
|
77
|
-
expect(response['content']
|
77
|
+
expect(response['content']).to be_an_instance_of(String)
|
78
78
|
expect(response['type']).to eql "error"
|
79
79
|
end
|
80
80
|
it 'test_valid_object_content_of_type_warning_is_logged' do
|
@@ -85,7 +85,7 @@ RSpec.describe FyipeLogger do
|
|
85
85
|
logger = FyipeLogger.new($apiUrl, $applicationLog["_id"], $applicationLog["key"])
|
86
86
|
response = logger.warning(log)
|
87
87
|
expect(response['content']["location"]).to eql log["location"]
|
88
|
-
expect(response['content']
|
88
|
+
expect(response['content']).to be_an_instance_of(Hash)
|
89
89
|
expect(response['type']).to eql "warning"
|
90
90
|
end
|
91
91
|
it 'test_valid_object_content_of_type_warning_with_one_tag_is_logged' do
|
@@ -97,9 +97,9 @@ RSpec.describe FyipeLogger do
|
|
97
97
|
logger = FyipeLogger.new($apiUrl, $applicationLog["_id"], $applicationLog["key"])
|
98
98
|
response = logger.warning(log, tag)
|
99
99
|
expect(response['content']["location"]).to eql log["location"]
|
100
|
-
expect(response['content']
|
100
|
+
expect(response['content']).to be_an_instance_of(Hash)
|
101
101
|
expect(response['type']).to eql "warning"
|
102
|
-
expect(response['tags']
|
102
|
+
expect(response['tags']).to be_an_instance_of(Array)
|
103
103
|
expect(response['tags'].find { |item| item == tag }).to_not be_nil
|
104
104
|
end
|
105
105
|
it 'test_valid_object_content_of_type_error_with_no_tag_is_logged' do
|
@@ -107,10 +107,8 @@ RSpec.describe FyipeLogger do
|
|
107
107
|
logger = FyipeLogger.new($apiUrl, $applicationLog["_id"], $applicationLog["key"])
|
108
108
|
response = logger.error(log)
|
109
109
|
expect(response['content']).to eql log
|
110
|
-
expect(response['content']
|
110
|
+
expect(response['content']).to be_an_instance_of(String)
|
111
111
|
expect(response['type']).to eql "error"
|
112
|
-
expect(response['tags'].class.to_s).to eql "Array"
|
113
|
-
expect(response['tags']).to eql []
|
114
112
|
end
|
115
113
|
it 'test_valid_object_content_of_type_warning_with_four_tags_is_logged' do
|
116
114
|
log = {
|
@@ -121,9 +119,9 @@ RSpec.describe FyipeLogger do
|
|
121
119
|
logger = FyipeLogger.new($apiUrl, $applicationLog["_id"], $applicationLog["key"])
|
122
120
|
response = logger.warning(log, tags)
|
123
121
|
expect(response['content']["location"]).to eql log["location"]
|
124
|
-
expect(response['content']
|
122
|
+
expect(response['content']).to be_an_instance_of(Hash)
|
125
123
|
expect(response['type']).to eql "warning"
|
126
|
-
expect(response['tags']
|
124
|
+
expect(response['tags']).to be_an_instance_of(Array)
|
127
125
|
tags.each {
|
128
126
|
|tag| expect(response['tags'].find { |item| item == tag }).to_not be_nil
|
129
127
|
}
|
data/spec/fyipe_tracker_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fyipe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.12021.pre.qa
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- HackerBay, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-06-
|
11
|
+
date: 2021-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -154,6 +154,7 @@ files:
|
|
154
154
|
- README.md
|
155
155
|
- RakeFile
|
156
156
|
- fyipe.gemspec
|
157
|
+
- lib/fyipe.rb
|
157
158
|
- lib/fyipe/fyipeListener.rb
|
158
159
|
- lib/fyipe/fyipeTransport.rb
|
159
160
|
- lib/fyipe/logtype.rb
|
@@ -181,9 +182,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
181
182
|
version: 2.5.0
|
182
183
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
183
184
|
requirements:
|
184
|
-
- - "
|
185
|
+
- - ">"
|
185
186
|
- !ruby/object:Gem::Version
|
186
|
-
version:
|
187
|
+
version: 1.3.1
|
187
188
|
requirements: []
|
188
189
|
rubyforge_project:
|
189
190
|
rubygems_version: 2.7.6
|