soaspec 0.2.12 → 0.2.13
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 +4 -4
- data/ChangeLog +4 -0
- data/README.md +24 -1
- data/lib/soaspec/spec_logger.rb +5 -1
- data/lib/soaspec/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0083db30d4a6c0ecee3867fd083318cb06fb971
|
4
|
+
data.tar.gz: 4a09507a106955ee4d8728f2335a69641189bdbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adfe9d60caad2441f1b83c0aef71ba7f56bb4d4cfad85890422fcc9ffa3ad262c467f3571094d6bc03d1e105fe56e882c441daa2de1ca266bfb3b8b9ffdfc773
|
7
|
+
data.tar.gz: e82c9d480898b80c549892048695d80fd733df5c91fdf90fa330aebe5c5bec44a7831aaae7fbdb64c6f60ba475b513d671c1cd2e2dd07efacfcd3ac2b3e82087
|
data/ChangeLog
CHANGED
data/README.md
CHANGED
@@ -175,6 +175,10 @@ expect(@exchange['message']).to include 'success'
|
|
175
175
|
expect(@exchange.status_code).to eq 200
|
176
176
|
```
|
177
177
|
|
178
|
+
### Authentication
|
179
|
+
|
180
|
+
See [the wiki](https://gitlab.com/samuel-garratt/soaspec/wikis/Authentication) for details.
|
181
|
+
|
178
182
|
## Logging
|
179
183
|
|
180
184
|
By default traffic is logged to a file in the `logs` folder called `traffic_DATETIME.log`.
|
@@ -182,7 +186,26 @@ By default traffic is logged to a file in the `logs` folder called `traffic_DATE
|
|
182
186
|
The `SpecLogger` class is responsible for handling all the logs.
|
183
187
|
|
184
188
|
To change the output file location to 'custom.log':
|
185
|
-
|
189
|
+
```ruby
|
190
|
+
Soaspec::SpecLogger.traffic_file = 'custom.log'
|
191
|
+
```
|
192
|
+
|
193
|
+
To change the folder the default log is:
|
194
|
+
|
195
|
+
```ruby
|
196
|
+
Soaspec::SpecLogger.traffic_folder = 'custom_folder'
|
197
|
+
```
|
198
|
+
|
199
|
+
To disable logging to a file set the 'output_to_file' to 'false'.
|
200
|
+
```ruby
|
201
|
+
Soaspec::SpecLogger.output_to_file = false
|
202
|
+
```
|
203
|
+
There is a similar parameter to logging to the terminal, STDOUT (by default false).
|
204
|
+
You can also change the color of this output with the `terminal_color` attribute.
|
205
|
+
```ruby
|
206
|
+
Soaspec::SpecLogger.output_to_terminal = true
|
207
|
+
Soaspec::SpecLogger.terminal_color = :magenta
|
208
|
+
```
|
186
209
|
|
187
210
|
## Development
|
188
211
|
|
data/lib/soaspec/spec_logger.rb
CHANGED
@@ -19,6 +19,8 @@ module Soaspec
|
|
19
19
|
@traffic_folder = 'logs'
|
20
20
|
# Whether to output api traffic to terminal
|
21
21
|
@output_to_terminal = false
|
22
|
+
# Color shown when displaying in terminal
|
23
|
+
@terminal_color = :light_blue
|
22
24
|
# Whether to output API traffic to log file
|
23
25
|
@output_to_file = true
|
24
26
|
# Time test run. Will only be calculated once once called
|
@@ -28,6 +30,8 @@ module Soaspec
|
|
28
30
|
class << self
|
29
31
|
# Folder to put API traffic logs
|
30
32
|
attr_accessor :traffic_folder
|
33
|
+
# Color shown when displaying in terminal
|
34
|
+
attr_accessor :terminal_color
|
31
35
|
# Readers for log parameters
|
32
36
|
attr_reader :output_to_terminal, :output_to_file, :time_test_run
|
33
37
|
# Set file to log traffic to
|
@@ -71,7 +75,7 @@ module Soaspec
|
|
71
75
|
@logger = ApiLogger.new(traffic_file) # Where request and responses of APIs are stored
|
72
76
|
@logger.formatter = proc do |severity, datetime, _progname, msg|
|
73
77
|
message = "SpecLog, [#{datetime.strftime('%Y-%m-%d_%H:%M:%S')}] #{severity} -- : #{msg}\n"
|
74
|
-
print message.colorize(
|
78
|
+
print message.colorize(terminal_color) if @output_to_terminal
|
75
79
|
message if @output_to_file
|
76
80
|
end
|
77
81
|
@logger
|
data/lib/soaspec/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soaspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SamuelGarrattIQA
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|