fyipe 3.0.11962.pre.qa → 3.0.12005.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 +131 -0
- data/lib/fyipe.rb +2 -0
- data/lib/fyipe/version.rb +1 -1
- data/lib/fyipeTracker.rb +1 -1
- data/spec/fyipe_logger_spec.rb +10 -12
- data/spec/fyipe_tracker_spec.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7cd6b2e3cef633df0aef32eea26122a53fe3690cd08211f6b8ee4f67fdb8fe6
|
4
|
+
data.tar.gz: 22bdd963c3ea45a6cdd56141fe13693c443a4afde2f62388af8c3ce381b180f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48f334801cce2fde6c86191bd0b89611cafa3370e6f4188fb7673835d1981c9f27a76daf5d4b51c98f6a4c7257edc93f94d5257adf844df37c71339c4529f1e6
|
7
|
+
data.tar.gz: 21650569ea71ab49c9f00d7205e177430c08e225c45bd185a3f718fdec34a457d5c83f86aba4f3eb1e7af4176a0e30d136b063fe7a27fcc07687b8e55d8b8811
|
data/README.md
CHANGED
@@ -61,6 +61,35 @@ 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
|
+
# constructor
|
70
|
+
|
71
|
+
# set up tracking configurations
|
72
|
+
options = {
|
73
|
+
"maxTimeline": 50,
|
74
|
+
"captureCodeSnippet": true
|
75
|
+
}
|
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 error exception manually and sent to your fyipe dashboard
|
84
|
+
begin
|
85
|
+
# your code logic
|
86
|
+
result = 5/0 # Should throw a division by zero error
|
87
|
+
rescue => ex
|
88
|
+
tracker.captureException(ex)
|
89
|
+
end
|
90
|
+
|
91
|
+
```
|
92
|
+
|
64
93
|
## API Documentation
|
65
94
|
|
66
95
|
Main API to send logs to the server.
|
@@ -71,11 +100,20 @@ Main API to send logs to the server.
|
|
71
100
|
- [Installation](#installation)
|
72
101
|
- [Gem Install](#gem-install)
|
73
102
|
- [Basic Usage for Logging](#basic-usage-for-logging)
|
103
|
+
- [Basic Usage for Tracking](#basic-usage-for-tracking)
|
74
104
|
- [API Documentation](#api-documentation)
|
75
105
|
- [FyipeLogger.new(apiUrl, applicationId, applicationKey)](#fyipeloggernewapiurl-applicationid-applicationkey)
|
76
106
|
- [logger.log(log, \tags)](#loggerloglog-tags)
|
77
107
|
- [logger.warning(warning, \tags)](#loggerwarningwarning-tags)
|
78
108
|
- [logger.error(error, \tags)](#loggererrorerror-tags)
|
109
|
+
- [FyipeTracker.new(apiUrl, errorTrackerId, errorTrackerKey)](#fyipetrackernewapiurl-errortrackerid-errortrackerkey)
|
110
|
+
- [options](#options)
|
111
|
+
- [tracker.setTag(key, value)](#trackersettagkey-value)
|
112
|
+
- [tracker.setTags([{key, value}])](#trackersettagskey-value)
|
113
|
+
- [tracker.setFingerprint(fingerprint)](#trackersetfingerprintfingerprint)
|
114
|
+
- [tracker.addToTimeline(category, content, type)](#trackeraddtotimelinecategory-content-type)
|
115
|
+
- [tracker.captureMessage(message)](#trackercapturemessagemessage)
|
116
|
+
- [tracker.captureException(error)](#trackercaptureexceptionerror)
|
79
117
|
- [Contribution](#contribution)
|
80
118
|
|
81
119
|
<a name="logger_api--logger"></a>
|
@@ -129,6 +167,99 @@ Logs a request of type `error` to the server.
|
|
129
167
|
| \error | <code>string</code> \| <code>Object</code> | The content to the logged on the server. |
|
130
168
|
| \tags | <code>string</code> \| <code>Array</code> | The tag(s) to be attached to the logged item on the server. |
|
131
169
|
|
170
|
+
<a name="tracker_api--tracker"></a>
|
171
|
+
|
172
|
+
### FyipeTracker.new(apiUrl, errorTrackerId, errorTrackerKey)
|
173
|
+
|
174
|
+
Create a constructor from the class, which will be used to track errors sent to the server.
|
175
|
+
|
176
|
+
**Kind**: Constructor
|
177
|
+
**Returns**: <code>null</code>
|
178
|
+
|
179
|
+
| Param | Type | Description |
|
180
|
+
| --------------- | ------------------- | ------------------------------------------- |
|
181
|
+
| apiUrl | <code>string</code> | The Server URL. |
|
182
|
+
| errorTrackerId | <code>string</code> | The Error Tracker ID. |
|
183
|
+
| errorTrackerKey | <code>string</code> | The Error Tracker Key. |
|
184
|
+
| option | <code>object</code> | The options to be considred by the tracker. |
|
185
|
+
|
186
|
+
#### options
|
187
|
+
|
188
|
+
| Param | Type | Description |
|
189
|
+
| ------------------ | -------------------- | ----------------------------------------------------------------------------------------------------- |
|
190
|
+
| maxTimeline | <code>int</code> | The total amount of timeline that should be captured, defaults to 5 |
|
191
|
+
| captureCodeSnippet | <code>boolean</code> | When set as `true` stack traces are automatically attached to all error sent to your fyipe dashboard. |
|
192
|
+
|
193
|
+
#### tracker.setTag(key, value)
|
194
|
+
|
195
|
+
Set tag for the error to be sent to the server.
|
196
|
+
|
197
|
+
**Kind**: method of [<code>FyipeTracker</code>](#tracker_api--tracker)
|
198
|
+
**Returns**: <code>null</code>
|
199
|
+
|
200
|
+
| Param | Type | Description |
|
201
|
+
| ----- | ------------------- | ---------------------- |
|
202
|
+
| key | <code>string</code> | The key for the tag. |
|
203
|
+
| value | <code>string</code> | The value for the tag. |
|
204
|
+
|
205
|
+
#### tracker.setTags([{key, value}])
|
206
|
+
|
207
|
+
Set multiple tags for the error to be sent to the server. Takes in a list
|
208
|
+
|
209
|
+
**Kind**: method of [<code>FyipeTracker</code>](#tracker_api--tracker)
|
210
|
+
**Returns**: <code>null</code>
|
211
|
+
|
212
|
+
| Param | Type | Description |
|
213
|
+
| ----- | ------------------- | ---------------------- |
|
214
|
+
| key | <code>string</code> | The key for the tag. |
|
215
|
+
| value | <code>string</code> | The value for the tag. |
|
216
|
+
|
217
|
+
#### tracker.setFingerprint(fingerprint)
|
218
|
+
|
219
|
+
Set fingerprint for the next error to be captured.
|
220
|
+
|
221
|
+
**Kind**: method of [<code>FyipeTracker</code>](#tracker_api--tracker)
|
222
|
+
**Returns**: <code>null</code>
|
223
|
+
|
224
|
+
| Param | Type | Description |
|
225
|
+
| ----------- | --------------------------------------------------- | ------------------------------------------------------------- |
|
226
|
+
| fingerprint | <code>string</code> \| <code>list of strings</code> | The set of string used to group error messages on the server. |
|
227
|
+
|
228
|
+
#### tracker.addToTimeline(category, content, type)
|
229
|
+
|
230
|
+
Add a custom timeline element to the next error to be sent to the server
|
231
|
+
|
232
|
+
**Kind**: method of [<code>FyipeTracker</code>](#tracker_api--tracker)
|
233
|
+
**Returns**: <code>null</code>
|
234
|
+
|
235
|
+
| Param | Type | Description |
|
236
|
+
| -------- | ------------------------------------------ | ----------------------------------- |
|
237
|
+
| category | <code>string</code> | The category of the timeline event. |
|
238
|
+
| content | <code>string</code> \| <code>object</code> | The content of the timeline event. |
|
239
|
+
| type | <code>string</code> | The type of timeline event. |
|
240
|
+
|
241
|
+
#### tracker.captureMessage(message)
|
242
|
+
|
243
|
+
Capture a custom error message to be sent to the server
|
244
|
+
|
245
|
+
**Kind**: method of [<code>FyipeTracker</code>](#tracker_api--tracker)
|
246
|
+
**Returns**: <code>Promise</code>
|
247
|
+
|
248
|
+
| Param | Type | Description |
|
249
|
+
| ------- | ------------------- | ------------------------------------- |
|
250
|
+
| message | <code>string</code> | The message to be sent to the server. |
|
251
|
+
|
252
|
+
#### tracker.captureException(error)
|
253
|
+
|
254
|
+
Capture a custom error object to be sent to the server
|
255
|
+
|
256
|
+
**Kind**: method of [<code>FyipeTracker</code>](#tracker_api--tracker)
|
257
|
+
**Returns**: <code>Promise</code>
|
258
|
+
|
259
|
+
| Param | Type | Description |
|
260
|
+
| ----- | ----------------------------- | ------------------------------------------ |
|
261
|
+
| error | <code>Exception object</code> | The Error Object to be sent to the server. |
|
262
|
+
|
132
263
|
## Contribution
|
133
264
|
|
134
265
|
- 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
|
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.12005.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
|