bugsnag-maze-runner 7.33.1 → 8.0.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.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/bin/maze-runner +9 -1
  3. data/bin/purge-projects +66 -0
  4. data/lib/features/steps/app_automator_steps.rb +9 -3
  5. data/lib/features/steps/header_steps.rb +13 -9
  6. data/lib/features/steps/multipart_request_steps.rb +10 -10
  7. data/lib/features/steps/network_steps.rb +7 -24
  8. data/lib/features/steps/payload_steps.rb +21 -21
  9. data/lib/features/steps/query_parameter_steps.rb +3 -3
  10. data/lib/features/steps/request_assertion_steps.rb +11 -18
  11. data/lib/features/steps/trace_steps.rb +0 -8
  12. data/lib/features/steps/value_steps.rb +9 -9
  13. data/lib/features/support/cucumber_types.rb +20 -0
  14. data/lib/features/support/internal_hooks.rb +0 -2
  15. data/lib/maze/api/appium/file_manager.rb +1 -1
  16. data/lib/maze/appium_server.rb +2 -2
  17. data/lib/maze/client/appium/bb_client.rb +1 -1
  18. data/lib/maze/client/appium/bb_devices.rb +1 -1
  19. data/lib/maze/client/appium/bs_devices.rb +7 -9
  20. data/lib/maze/client/bb_api_client.rb +46 -9
  21. data/lib/maze/client/bb_client_utils.rb +1 -61
  22. data/lib/maze/client/selenium/bb_client.rb +1 -6
  23. data/lib/maze/client/selenium/bs_browsers.yml +11 -11
  24. data/lib/maze/configuration.rb +0 -6
  25. data/lib/maze/logger.rb +29 -1
  26. data/lib/maze/option/parser.rb +39 -14
  27. data/lib/maze/option/processor.rb +2 -5
  28. data/lib/maze/option/validator.rb +3 -7
  29. data/lib/maze/option.rb +2 -6
  30. data/lib/maze/repeaters/request_repeater.rb +1 -1
  31. data/lib/maze/schemas/trace_validator.rb +0 -2
  32. data/lib/maze/server.rb +13 -3
  33. data/lib/maze/servlets/servlet.rb +13 -10
  34. data/lib/maze/servlets/trace_servlet.rb +15 -0
  35. data/lib/maze/terminating_server.rb +1 -1
  36. data/lib/maze.rb +1 -1
  37. metadata +5 -3
  38. data/lib/maze/plugins/cucumber_report_plugin.rb +0 -101
@@ -7,14 +7,6 @@ When('I wait for {int} span(s)') do |span_count|
7
7
  assert_received_spans span_count, Maze::Server.list_for('traces')
8
8
  end
9
9
 
10
- When('I receive and discard the initial p-value request') do
11
- steps %Q{
12
- And I wait to receive at least 1 trace
13
- And the trace payload field "resourceSpans" is an array with 0 elements
14
- And I discard the oldest trace
15
- }
16
- end
17
-
18
10
  Then('I should have received no spans') do
19
11
  sleep Maze.config.receive_no_requests_wait
20
12
  Maze.check.equal spans_from_request_list(Maze::Server.list_for('traces')).size, 0
@@ -7,7 +7,7 @@ require 'date'
7
7
  # @step_input request_type [String] The type of request (error, session, build, etc)
8
8
  # @step_input field [String] The payload field to store
9
9
  # @step_input key [String] The key to store the value against
10
- Then('the {word} payload field {string} is stored as the value {string}') do |request_type, field, key|
10
+ Then('the {request_type} payload field {string} is stored as the value {string}') do |request_type, field, key|
11
11
  list = Maze::Server.list_for request_type
12
12
  value = Maze::Helper.read_key_path(list.current[:body], field)
13
13
  Maze::Store.values[key] = value.dup
@@ -18,7 +18,7 @@ end
18
18
  # @step_input request_type [String] The type of request (error, session, build, etc)
19
19
  # @step_input field [String] The payload field to test
20
20
  # @step_input key [String] The key indicating a previously stored value
21
- Then('the {word} payload field {string} equals the stored value {string}') do |request_type, field, key|
21
+ Then('the {request_type} payload field {string} equals the stored value {string}') do |request_type, field, key|
22
22
  list = Maze::Server.list_for request_type
23
23
  payload_value = Maze::Helper.read_key_path(list.current[:body], field)
24
24
  stored_value = Maze::Store.values[key]
@@ -31,7 +31,7 @@ end
31
31
  # @step_input request_type [String] The type of request (error, session, build, etc)
32
32
  # @step_input field [String] The payload field to test
33
33
  # @step_input key [String] The key indicating a previously stored value
34
- Then('the {word} payload field {string} does not equal the stored value {string}') do |request_type, field, key|
34
+ Then('the {request_type} payload field {string} does not equal the stored value {string}') do |request_type, field, key|
35
35
  list = Maze::Server.list_for request_type
36
36
  payload_value = Maze::Helper.read_key_path(list.current[:body], field)
37
37
  stored_value = Maze::Store.values[key]
@@ -44,7 +44,7 @@ end
44
44
  # @step_input request_type [String] The type of request (error, session, build, etc)
45
45
  # @step_input field [String] The payload field to test
46
46
  # @step_input key [String] The key indicating a previously stored value
47
- Then('the {word} payload field {string} equals the stored value {string} ignoring case') do |request_type, field, key|
47
+ Then('the {request_type} payload field {string} equals the stored value {string} ignoring case') do |request_type, field, key|
48
48
  list = Maze::Server.list_for request_type
49
49
  payload_value = Maze::Helper.read_key_path(list.current[:body], field)
50
50
  stored_value = Maze::Store.values[key]
@@ -59,7 +59,7 @@ end
59
59
  # @step_input request_type [String] The type of request (error, session, build, etc)
60
60
  # @step_input field [String] The payload field to test
61
61
  # @step_input key [String] The key indicating a previously stored value
62
- Then('the {word} payload field {string} does not equal the stored value {string} ignoring case') do |request_type, field, key|
62
+ Then('the {request_type} payload field {string} does not equal the stored value {string} ignoring case') do |request_type, field, key|
63
63
  list = Maze::Server.list_for request_type
64
64
  payload_value = Maze::Helper.read_key_path(list.current[:body], field)
65
65
  stored_value = Maze::Store.values[key]
@@ -73,7 +73,7 @@ end
73
73
  #
74
74
  # @step_input request_type [String] The type of request (error, session, build, etc)
75
75
  # @step_input field [String] The payload field to test
76
- Then('the {word} payload field {string} is a number') do |request_type, field|
76
+ Then('the {request_type} payload field {string} is a number') do |request_type, field|
77
77
  list = Maze::Server.list_for request_type
78
78
  value = Maze::Helper.read_key_path(list.current[:body], field)
79
79
  Maze.check.kind_of Numeric, value
@@ -83,7 +83,7 @@ end
83
83
  #
84
84
  # @step_input request_type [String] The type of request (error, session, build, etc)
85
85
  # @step_input field [String] The payload field to test
86
- Then('the {word} payload field {string} is an integer') do |request_type, field|
86
+ Then('the {request_type} payload field {string} is an integer') do |request_type, field|
87
87
  list = Maze::Server.list_for request_type
88
88
  value = Maze::Helper.read_key_path(list.current[:body], field)
89
89
  Maze.check.kind_of Integer, value
@@ -93,7 +93,7 @@ end
93
93
  #
94
94
  # @step_input request_type [String] The type of request (error, session, build, etc)
95
95
  # @step_input field [String] The payload field to test
96
- Then('the {word} payload field {string} is a date') do |request_type, field|
96
+ Then('the {request_type} payload field {string} is a date') do |request_type, field|
97
97
  list = Maze::Server.list_for request_type
98
98
  value = Maze::Helper.read_key_path(list.current[:body], field)
99
99
  date = begin
@@ -108,7 +108,7 @@ end
108
108
  #
109
109
  # @step_input request_type [String] The type of request (error, session, build, etc)
110
110
  # @step_input field [String] The payload field to test
111
- Then('the {word} payload field {string} is a UUID') do |request_type, field|
111
+ Then('the {request_type} payload field {string} is a UUID') do |request_type, field|
112
112
  list = Maze::Server.list_for request_type
113
113
  value = Maze::Helper.read_key_path(list.current[:body], field)
114
114
  Maze.check.not_nil(value, "Expected UUID, got nil for #{field}")
@@ -0,0 +1,20 @@
1
+ ParameterType(
2
+ name: 'request_type',
3
+ regexp: /errors?|sessions?|builds?|logs?|metrics?|sampling requests?|traces?|uploads?|sourcemaps?|invalid requests?/,
4
+ type: String,
5
+ transformer: ->(s) { s }
6
+ )
7
+
8
+ ParameterType(
9
+ name: 'orientation',
10
+ regexp: /portrait|landscape/,
11
+ type: String,
12
+ transformer: ->(s) { s.to_sym }
13
+ )
14
+
15
+ ParameterType(
16
+ name: 'int_array',
17
+ regexp: /\d+(?:, ?\d+)*/,
18
+ type: String,
19
+ transformer: ->(s) { s.split(',').map(&:strip).map(&:to_i) }
20
+ )
@@ -90,8 +90,6 @@ InstallPlugin do |config|
90
90
  # Only add the retry plugin if --retry is not used on the command line
91
91
  config.filters << Maze::Plugins::GlobalRetryPlugin.new(config) if config.options[:retry].zero?
92
92
  config.filters << Maze::Plugins::BugsnagReportingPlugin.new(config)
93
- cucumber_report_plugin = Maze::Plugins::CucumberReportPlugin.new
94
- cucumber_report_plugin.install_plugin(config)
95
93
  end
96
94
 
97
95
  # Before each scenario
@@ -20,7 +20,7 @@ module Maze
20
20
  "/sdcard/Android/data/#{@driver.app_id}/files/#{filename}"
21
21
  end
22
22
 
23
- $logger.debug "Pushing file to '#{path}' with contents: #{contents}"
23
+ $logger.trace "Pushing file to '#{path}' with contents: #{contents}"
24
24
  @driver.push_file(path, contents)
25
25
  end
26
26
  end
@@ -44,7 +44,7 @@ module Maze
44
44
  @appium_thread = Thread.new do
45
45
  PTY.spawn(command) do |stdout, _stdin, pid|
46
46
  @pid = pid
47
- $logger.debug("Appium:#{@pid}") { 'Appium server started' }
47
+ $logger.trace("Appium:#{@pid}") { 'Appium server started' }
48
48
  stdout.each do |line|
49
49
  log_line(line)
50
50
  end
@@ -66,7 +66,7 @@ module Maze
66
66
  def stop
67
67
  return unless running
68
68
 
69
- $logger.debug("Appium:#{@pid}") { 'Stopping appium server' }
69
+ $logger.trace("Appium:#{@pid}") { 'Stopping appium server' }
70
70
  Process.kill('INT', @pid)
71
71
  @pid = nil
72
72
  @appium_thread.join
@@ -29,7 +29,7 @@ module Maze
29
29
  prefix = BitBarDevices.caps_prefix(config.appium_version)
30
30
  capabilities = {
31
31
  "#{prefix}noReset" => true,
32
- "#{prefix}newCommandTimeout" => 600,
32
+ "#{prefix}newCommandTimeout" => 0,
33
33
  'bitbar:options' => {
34
34
  # Some capabilities probably belong in the top level
35
35
  # of the hash, but BitBar picks them up from here.
@@ -17,7 +17,7 @@ module Maze
17
17
  device_group_ids = api_client.get_device_group_ids(device_or_group_names)
18
18
  if device_group_ids
19
19
  # Device group found - find a free device in it
20
- $logger.debug "Got group ids #{device_group_ids} for #{device_or_group_names}"
20
+ $logger.trace "Got group ids #{device_group_ids} for #{device_or_group_names}"
21
21
  group_count, device = api_client.find_device_in_groups(device_group_ids)
22
22
  if device.nil?
23
23
  # TODO: Retry rather than fail, see PLAT-7377
@@ -70,15 +70,13 @@ module Maze
70
70
  def create_hash
71
71
  hash = {
72
72
  # Classic, non-specific devices for each Android version
73
- 'ANDROID_13_0' => make_android_hash('Google Pixel 6 Pro', '13.0'),
74
- 'ANDROID_13_0_BETA' => make_android_hash('Google Pixel 6 Pro', '13 Beta'),
75
- 'ANDROID_12_0' => make_android_hash('Google Pixel 5', '12.0'),
76
- 'ANDROID_11_0' => make_android_hash('Google Pixel 4', '11.0'),
77
- 'ANDROID_10_0' => make_android_hash('Google Pixel 4', '10.0'),
78
- 'ANDROID_9_0' => make_android_hash('Google Pixel 3', '9.0'),
79
- 'ANDROID_8_1' => make_android_hash('Samsung Galaxy Note 9', '8.1'),
80
- 'ANDROID_8_0' => make_android_hash('Google Pixel 2', '8.0'),
81
- 'ANDROID_7_1' => make_android_hash('Google Pixel', '7.1'),
73
+ 'ANDROID_13' => make_android_hash('Google Pixel 6 Pro', '13.0'),
74
+ 'ANDROID_12' => make_android_hash('Google Pixel 5', '12.0'),
75
+ 'ANDROID_11' => make_android_hash('Google Pixel 4', '11.0'),
76
+ 'ANDROID_10' => make_android_hash('Google Pixel 4', '10.0'),
77
+ 'ANDROID_9' => make_android_hash('Google Pixel 3', '9.0'),
78
+ 'ANDROID_8' => make_android_hash('Samsung Galaxy Note 9', '8.1'),
79
+ 'ANDROID_7' => make_android_hash('Google Pixel', '7.1'),
82
80
 
83
81
  # iOS devices
84
82
  'IOS_16' => make_ios_hash('iPhone 14', '16'),
@@ -44,7 +44,7 @@ module Maze
44
44
  all_devices += query_api(path, query)['data']
45
45
  end
46
46
 
47
- $logger.debug "All available devices in group(s) #{device_group_ids}: #{JSON.pretty_generate(all_devices)}"
47
+ $logger.trace "All available devices in group(s) #{device_group_ids}: #{JSON.pretty_generate(all_devices)}"
48
48
  filtered_devices = all_devices.reject { |device| device['locked'] }
49
49
 
50
50
  # Only send gauges to DataDog for single device groups
@@ -64,7 +64,7 @@ module Maze
64
64
  if all_devices.size == 0
65
65
  Maze::Helper.error_exit "No devices found with name '#{device_name}'"
66
66
  else
67
- $logger.debug "All available devices with name #{device_name}: #{JSON.pretty_generate(all_devices)}"
67
+ $logger.trace "All available devices with name #{device_name}: #{JSON.pretty_generate(all_devices)}"
68
68
  filtered_devices = all_devices.reject { |device| device['locked'] }
69
69
  if filtered_devices.size == 0
70
70
  Maze::Helper.error_exit "None of the #{all_devices.size} devices with name '#{device_name}' are currently available"
@@ -88,23 +88,60 @@ module Maze
88
88
  end
89
89
  end
90
90
 
91
+ def get_projects(pattern)
92
+ query = {
93
+ 'limit': "1000"
94
+ }
95
+
96
+ project_data = query_api('projects', query)
97
+
98
+ begin
99
+ projects = Hash.new
100
+ project_data['data'].each do |child|
101
+ if child['name'].match(pattern)
102
+ projects[child['name']] = child['id']
103
+ end
104
+ end
105
+ rescue StandardError => e
106
+ $logger.error "Error getting projects from BitBar"
107
+ $logger.error e
108
+ raise
109
+ end
110
+ projects
111
+ end
112
+
113
+ def delete_project (id)
114
+ response = query_api "projects/#{id}"
115
+ end
116
+
91
117
  private
92
118
 
93
119
  # Queries the BitBar REST API
94
- def query_api(path, query=nil, uri=USER_SPECIFIC_URI)
120
+ def query_api(path, query=nil, uri=USER_SPECIFIC_URI, method="get")
95
121
  if query
96
122
  encoded_query = URI.encode_www_form(query)
97
123
  uri = URI("#{uri}/#{path}?#{encoded_query}")
98
124
  else
99
125
  uri = URI("#{uri}/#{path}")
100
126
  end
101
- request = Net::HTTP::Get.new(uri)
102
- request.basic_auth(@access_key, '')
103
- res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
104
- http.request(request)
105
- end
106
127
 
107
- JSON.parse(res.body)
128
+ if method == "get"
129
+ request = Net::HTTP::Get.new(uri)
130
+ request.basic_auth(@access_key, '')
131
+ res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
132
+ http.request(request)
133
+ end
134
+
135
+ return JSON.parse(res.body)
136
+ elsif method == "delete"
137
+ request = Net::HTTP::Delete.new(uri)
138
+ request.basic_auth(@access_key, '')
139
+ res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
140
+ http.request(request)
141
+ end
142
+
143
+ return res
144
+ end
108
145
  end
109
146
  end
110
147
  end
@@ -63,66 +63,6 @@ module Maze
63
63
  app_uuid
64
64
  end
65
65
 
66
- # Requests an unused account id from the test-management-service
67
- # @param tms_uri [String] The URI of the test-management-service
68
- #
69
- # @returns
70
- def account_credentials(tms_uri)
71
- interval_seconds = 10
72
-
73
- credentials = Maze::Wait.new(interval: interval_seconds, timeout: 1800).until do
74
- output = request_account_index(tms_uri)
75
- case output.code
76
- when '200'
77
- body = JSON.parse(output.body, {symbolize_names: true})
78
- @account_id = account_id = body[:id]
79
- $logger.info "Using account #{account_id}, expiring at #{body[:expiry]}"
80
- {
81
- username: ENV["#{BB_USER_PREFIX}#{account_id}"],
82
- access_key: ENV["#{BB_KEY_PREFIX}#{account_id}"]
83
- }
84
- when '409'
85
- # All accounts are in use, wait for one to become available
86
- $logger.info("All accounts are currently in use, retrying in #{interval_seconds}s")
87
- false
88
- else
89
- # Something has gone wrong, throw an error
90
- $logger.error "Unexpected status code (#{output.code}) received from test-management server: #{output.body}"
91
- raise
92
- end
93
- end
94
-
95
- return credentials if credentials
96
-
97
- raise "Could not fetch BitBar credentials in time"
98
- end
99
-
100
- # Makes the HTTP call to acquire an account id
101
- # @param tms_uri [String] The URI of the test-management-service
102
- #
103
- # @returns
104
- def request_account_index(tms_uri)
105
- uri = URI("#{tms_uri}/account/request")
106
- request = Net::HTTP::Get.new(uri)
107
- request['Authorization'] = Maze.config.tms_token
108
- res = Net::HTTP.start(uri.hostname, uri.port) do |http|
109
- http.request(request)
110
- end
111
- res
112
- end
113
-
114
- # Informs the test-management-service that in-use account id is no longer in use
115
- # @param tms_uri [String] The URI of the test-management-service
116
- def release_account(tms_uri)
117
- $logger.info "Release account #{@account_id}"
118
- uri = URI("#{tms_uri}/account/release?account_id=#{@account_id}")
119
- request = Net::HTTP::Get.new(uri)
120
- request['Authorization'] = Maze.config.tms_token
121
- res = Net::HTTP.start(uri.hostname, uri.port) do |http|
122
- http.request(request)
123
- end
124
- end
125
-
126
66
  def use_local_tunnel?
127
67
  Maze.config.start_tunnel && !Maze.config.aws_public_ip
128
68
  end
@@ -225,7 +165,7 @@ module Maze
225
165
  end
226
166
 
227
167
  exit_status = wait_thr.value.to_i
228
- $logger.debug "Exit status: #{exit_status}"
168
+ $logger.trace "Exit status: #{exit_status}"
229
169
 
230
170
  output.each { |line| $logger.warn('SBSecureTunnel') {line.chomp} } unless exit_status == 0
231
171
 
@@ -13,11 +13,7 @@ module Maze
13
13
  config.capabilities = capabilities
14
14
 
15
15
  if Maze::Client::BitBarClientUtils.use_local_tunnel?
16
- if ENV['BUILDKITE']
17
- credentials = Maze::Client::BitBarClientUtils.account_credentials config.tms_uri
18
- capabilities['bitbar_apiKey'] = credentials[:access_key]
19
- end
20
-
16
+ capabilities['bitbar_apiKey'] = config.access_key
21
17
  Maze::Client::BitBarClientUtils.start_local_tunnel config.sb_local,
22
18
  config.username,
23
19
  config.access_key
@@ -41,7 +37,6 @@ module Maze
41
37
  super
42
38
  if Maze::Client::BitBarClientUtils.use_local_tunnel?
43
39
  Maze::Client::BitBarClientUtils.stop_local_tunnel
44
- Maze::Client::BitBarClientUtils.release_account(Maze.config.tms_uri) if ENV['BUILDKITE']
45
40
  end
46
41
  end
47
42
  end
@@ -96,77 +96,77 @@ safari_16:
96
96
  os: "OS X"
97
97
  osVersion: "Ventura"
98
98
 
99
- iphone_6s:
99
+ ios_9:
100
100
  browserName: "iphone"
101
101
  device: "iPhone 6S"
102
102
  os: "ios"
103
103
  osVersion: "9.0"
104
104
  realMobile: true
105
105
 
106
- iphone_7:
106
+ ios_10:
107
107
  browserName: "iphone"
108
108
  device: "iPhone 7"
109
109
  os: "ios"
110
110
  osVersion: "10.3"
111
111
  realMobile: true
112
112
 
113
- iphone_x:
113
+ ios_11:
114
114
  browserName: "iphone"
115
115
  device: "iPhone X"
116
116
  os: "ios"
117
117
  osVersion: "11"
118
118
  realMobile: true
119
119
 
120
- iphone_xs:
120
+ ios_12:
121
121
  browserName: "iphone"
122
122
  device: "iPhone XS"
123
123
  os: "ios"
124
124
  osVersion: "12"
125
125
  realMobile: true
126
126
 
127
- iphone_13:
127
+ ios_15:
128
128
  browserName: "iphone"
129
129
  device: "iPhone 13"
130
130
  os: "ios"
131
131
  osVersion: "15.4"
132
132
  realMobile: true
133
133
 
134
- iphone_14:
134
+ ios_16:
135
135
  browserName: "iphone"
136
136
  device: "iPhone 14"
137
137
  os: "ios"
138
138
  osVersion: "16"
139
139
  realMobile: true
140
140
 
141
- android_nexus5:
141
+ android_4:
142
142
  browserName: "Android Browser"
143
143
  device: "Google Nexus 5"
144
144
  os: "android"
145
145
  osVersion: "4.4"
146
146
  realMobile: true
147
147
 
148
- android_s6:
148
+ android_5:
149
149
  browserName: "Android Browser"
150
150
  device: "Samsung Galaxy S6"
151
151
  os: "android"
152
152
  osVersion: "5.0"
153
153
  realMobile: true
154
154
 
155
- android_s7:
155
+ android_6:
156
156
  browserName: "Android Browser"
157
157
  device: "Samsung Galaxy S7"
158
158
  os: "android"
159
159
  osVersion: "6.0"
160
160
  realMobile: true
161
161
 
162
- android_s8:
162
+ android_7:
163
163
  browserName: "Android Browser"
164
164
  device: "Samsung Galaxy S8 Plus"
165
165
  os: "android"
166
166
  osVersion: "7.0"
167
167
  realMobile: true
168
168
 
169
- android_pixel_7:
169
+ android_13:
170
170
  browserName: "Android Browser"
171
171
  device: "Google Pixel 7"
172
172
  os: "android"
@@ -133,12 +133,6 @@ module Maze
133
133
  # Appium version to use
134
134
  attr_accessor :appium_version
135
135
 
136
- # URI of the test-management service
137
- attr_accessor :tms_uri
138
-
139
- # Access token for the test-management service
140
- attr_accessor :tms_token
141
-
142
136
  # URL of the Appium server
143
137
  attr_accessor :appium_server_url
144
138
 
data/lib/maze/logger.rb CHANGED
@@ -3,6 +3,32 @@
3
3
  require 'logger'
4
4
  require 'singleton'
5
5
 
6
+ # Monkey patch a 'trace' log level into the standard Logger
7
+ class Logger
8
+ remove_const(:SEV_LABEL)
9
+ SEV_LABEL = {
10
+ -1 => 'TRACE',
11
+ 0 => 'DEBUG',
12
+ 1 => 'INFO',
13
+ 2 => 'WARN',
14
+ 3 => 'ERROR',
15
+ 4 => 'FATAL',
16
+ 5 => 'ANY'
17
+ }
18
+
19
+ module Severity
20
+ TRACE=-1
21
+ end
22
+
23
+ def trace(name = nil, &block)
24
+ add(TRACE, nil, name, &block)
25
+ end
26
+
27
+ def trace?
28
+ @level <= TRACE
29
+ end
30
+ end
31
+
6
32
  # Logger classes
7
33
  module Maze
8
34
  # A logger, with level configured according to the environment
@@ -12,7 +38,9 @@ module Maze
12
38
  attr_accessor :datetime_format
13
39
 
14
40
  def initialize
15
- if ENV['VERBOSE'] || ENV['DEBUG']
41
+ if ENV['TRACE']
42
+ super(STDOUT, level: Logger::TRACE)
43
+ elsif ENV['DEBUG']
16
44
  super(STDOUT, level: Logger::DEBUG)
17
45
  elsif ENV['QUIET']
18
46
  super(STDOUT, level: Logger::ERROR)