pantheios-ruby 0.18.2 → 0.22.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 +4 -4
- data/LICENSE +31 -0
- data/README.md +5 -0
- data/examples/coloured_console_log_service.rb +37 -0
- data/examples/multiple_modules.md +204 -0
- data/examples/multiple_modules.rb +132 -0
- data/examples/simple_logging.md +65 -0
- data/examples/simple_logging.rb +37 -0
- data/lib/pantheios/api.rb +21 -5
- data/lib/pantheios/application_layer/stock_severity_levels.rb +88 -27
- data/lib/pantheios/core.rb +30 -11
- data/lib/pantheios/front_ends/threshold_front_end.rb +135 -0
- data/lib/pantheios/globals.rb +14 -6
- data/lib/pantheios/services.rb +3 -0
- data/lib/pantheios/services/coloured_console_log_service.rb +204 -0
- data/lib/pantheios/services/common/console.rb +92 -0
- data/lib/pantheios/services/multiplexing_log_service.rb +277 -0
- data/lib/pantheios/services/null_log_service.rb +4 -3
- data/lib/pantheios/services/simple_console_log_service.rb +10 -8
- data/lib/pantheios/services/simple_file_log_service.rb +3 -2
- data/lib/pantheios/services/standard_log_service_adapter.rb +3 -2
- data/lib/pantheios/util/reflection_util.rb +2 -0
- data/lib/pantheios/util/thread_util.rb +1 -0
- data/lib/pantheios/version.rb +3 -2
- data/test/scratch/multiplexing_log_service.rb +109 -0
- data/test/unit/application_layer/tc_stock_severity_levels.rb +67 -0
- data/test/unit/front_ends/tc_threshold_front_end.rb +102 -0
- data/test/unit/front_ends/ts_all.rb +12 -0
- data/test/unit/services/tc_multiplexing_log_service.rb +144 -0
- data/test/unit/services/tc_simple_console_log_service.rb +3 -3
- metadata +24 -7
@@ -1,17 +1,18 @@
|
|
1
1
|
|
2
2
|
# ######################################################################## #
|
3
|
-
# File: lib/pantheios/services/
|
3
|
+
# File: lib/pantheios/services/null_log_service.rb
|
4
4
|
#
|
5
5
|
# Purpose: Definition of the ::Pantheios::Services::NullLogService
|
6
6
|
# class
|
7
7
|
#
|
8
8
|
# Created: 14th June 2015
|
9
|
-
# Updated:
|
9
|
+
# Updated: 4th June 2020
|
10
10
|
#
|
11
11
|
# Home: http://github.com/synesissoftware/Pantheios-Ruby
|
12
12
|
#
|
13
13
|
# Author: Matthew Wilson
|
14
14
|
#
|
15
|
+
# Copyright (c) 2019-2020, Matthew Wilson and Synesis Information Systems
|
15
16
|
# Copyright (c) 2015-2018, Matthew Wilson and Synesis Software
|
16
17
|
# All rights reserved.
|
17
18
|
#
|
@@ -56,7 +57,7 @@ module Services
|
|
56
57
|
#
|
57
58
|
# NOTE: The *LogService* protocol is implemented by a class that provides
|
58
59
|
# the instance methods +severity_logged?(severity : Object) : boolean+ and
|
59
|
-
# +log(severity : Object, t : Time, prefix : String, msg : String)+
|
60
|
+
# +log(severity : Object, t : Time, prefix : String|Array, msg : String)+
|
60
61
|
class NullLogService
|
61
62
|
|
62
63
|
def severity_logged? severity
|
@@ -6,12 +6,13 @@
|
|
6
6
|
# ::Pantheios::Services::SimpleConsoleLogService class
|
7
7
|
#
|
8
8
|
# Created: 14th June 2015
|
9
|
-
# Updated:
|
9
|
+
# Updated: 4th June 2020
|
10
10
|
#
|
11
11
|
# Home: http://github.com/synesissoftware/Pantheios-Ruby
|
12
12
|
#
|
13
13
|
# Author: Matthew Wilson
|
14
14
|
#
|
15
|
+
# Copyright (c) 2019-2020, Matthew Wilson and Synesis Information Systems
|
15
16
|
# Copyright (c) 2015-2018, Matthew Wilson and Synesis Software
|
16
17
|
# All rights reserved.
|
17
18
|
#
|
@@ -45,8 +46,6 @@
|
|
45
46
|
# ######################################################################## #
|
46
47
|
|
47
48
|
|
48
|
-
require 'pantheios/application_layer/stock_severity_levels'
|
49
|
-
|
50
49
|
=begin
|
51
50
|
=end
|
52
51
|
|
@@ -58,7 +57,7 @@ module Services
|
|
58
57
|
#
|
59
58
|
# NOTE: The *LogService* protocol is implemented by a class that provides
|
60
59
|
# the instance methods +severity_logged?(severity : Object) : boolean+ and
|
61
|
-
# +log(severity : Object, t : Time, prefix : String, msg : String)+
|
60
|
+
# +log(severity : Object, t : Time, prefix : String|Array, msg : String)+
|
62
61
|
class SimpleConsoleLogService
|
63
62
|
|
64
63
|
def severity_logged? severity
|
@@ -73,13 +72,16 @@ class SimpleConsoleLogService
|
|
73
72
|
stm.puts "#{pref}#{msg}"
|
74
73
|
end
|
75
74
|
|
75
|
+
# Overrideable method that determines which stream to write, based on a
|
76
|
+
# severity. This implementation always returns +$stderr+
|
77
|
+
#
|
78
|
+
# Overrides must return an object that supports the +puts(String)+
|
79
|
+
# method
|
76
80
|
def infer_stream sev
|
77
81
|
|
78
|
-
|
79
|
-
|
80
|
-
(sev.to_i < 6) ? $stderr : $stdout
|
82
|
+
$stderr
|
81
83
|
end
|
82
|
-
end
|
84
|
+
end # class SimpleConsoleLogService
|
83
85
|
|
84
86
|
end # module Services
|
85
87
|
end # module Pantheios
|
@@ -6,12 +6,13 @@
|
|
6
6
|
# ::Pantheios::Services::SimpleFileLogService class
|
7
7
|
#
|
8
8
|
# Created: 17th June 2015
|
9
|
-
# Updated: 4th
|
9
|
+
# Updated: 4th June 2020
|
10
10
|
#
|
11
11
|
# Home: http://github.com/synesissoftware/Pantheios-Ruby
|
12
12
|
#
|
13
13
|
# Author: Matthew Wilson
|
14
14
|
#
|
15
|
+
# Copyright (c) 2019-2020, Matthew Wilson and Synesis Information Systems
|
15
16
|
# Copyright (c) 2015-2018, Matthew Wilson and Synesis Software
|
16
17
|
# All rights reserved.
|
17
18
|
#
|
@@ -60,7 +61,7 @@ module Services
|
|
60
61
|
#
|
61
62
|
# NOTE: The *LogService* protocol is implemented by a class that provides
|
62
63
|
# the instance methods +severity_logged?(severity : Object) : boolean+ and
|
63
|
-
# +log(severity : Object, t : Time, prefix : String, msg : String)+
|
64
|
+
# +log(severity : Object, t : Time, prefix : String|Array, msg : String)+
|
64
65
|
class SimpleFileLogService
|
65
66
|
|
66
67
|
module SimpleFileLogService_Constants
|
@@ -6,12 +6,13 @@
|
|
6
6
|
# ::Pantheios::Services::StandardLogServiceAdapter class
|
7
7
|
#
|
8
8
|
# Created: 18th June 2015
|
9
|
-
# Updated:
|
9
|
+
# Updated: 4th June 2020
|
10
10
|
#
|
11
11
|
# Home: http://github.com/synesissoftware/Pantheios-Ruby
|
12
12
|
#
|
13
13
|
# Author: Matthew Wilson
|
14
14
|
#
|
15
|
+
# Copyright (c) 2019-2020, Matthew Wilson and Synesis Information Systems
|
15
16
|
# Copyright (c) 2015-2018, Matthew Wilson and Synesis Software
|
16
17
|
# All rights reserved.
|
17
18
|
#
|
@@ -64,7 +65,7 @@ module Services
|
|
64
65
|
#
|
65
66
|
# NOTE: The *LogService* protocol is implemented by a class that provides
|
66
67
|
# the instance methods +severity_logged?(severity : Object) : boolean+ and
|
67
|
-
# +log(severity : Object, t : Time, prefix : String, msg : String)+
|
68
|
+
# +log(severity : Object, t : Time, prefix : String|Array, msg : String)+
|
68
69
|
class StandardLogServiceAdapter
|
69
70
|
|
70
71
|
include ::Xqsr3::Quality::ParameterChecking
|
data/lib/pantheios/version.rb
CHANGED
@@ -5,12 +5,13 @@
|
|
5
5
|
# Purpose: Version for Pantheios.Ruby library
|
6
6
|
#
|
7
7
|
# Created: 2nd April 2011
|
8
|
-
# Updated:
|
8
|
+
# Updated: 3rd June 2020
|
9
9
|
#
|
10
10
|
# Home: http://github.com/synesissoftware/Pantheios-Ruby
|
11
11
|
#
|
12
12
|
# Author: Matthew Wilson
|
13
13
|
#
|
14
|
+
# Copyright (c) 2019-2020, Matthew Wilson and Synesis Information Systems
|
14
15
|
# Copyright (c) 2011-2019, Matthew Wilson and Synesis Software
|
15
16
|
# All rights reserved.
|
16
17
|
#
|
@@ -50,7 +51,7 @@
|
|
50
51
|
module Pantheios
|
51
52
|
|
52
53
|
# Current version of the Pantheios.Ruby library
|
53
|
-
VERSION = '0.
|
54
|
+
VERSION = '0.22.0'
|
54
55
|
|
55
56
|
private
|
56
57
|
VERSION_PARTS_ = VERSION.split(/[.]/).collect { |n| n.to_i } # :nodoc:
|
@@ -0,0 +1,109 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
#############################################################################
|
4
|
+
# File: test/scratch/multiplexing_log_service.rb
|
5
|
+
#
|
6
|
+
# Purpose: COMPLETE_ME
|
7
|
+
#
|
8
|
+
# Created: 7th February 2018
|
9
|
+
# Updated: 7th February 2018
|
10
|
+
#
|
11
|
+
# Author: Matthew Wilson
|
12
|
+
#
|
13
|
+
# Copyright: <<TBD>>
|
14
|
+
#
|
15
|
+
#############################################################################
|
16
|
+
|
17
|
+
$:.unshift File.join(File.dirname(__FILE__), *(['..'] * 2), 'lib')
|
18
|
+
|
19
|
+
require 'pantheios'
|
20
|
+
require 'pantheios/application_layer/stock_severity_levels'
|
21
|
+
require 'pantheios/services'
|
22
|
+
|
23
|
+
$num_BLS_sls = 0
|
24
|
+
$num_ELS_sls = 0
|
25
|
+
|
26
|
+
class BenchmarkLogService
|
27
|
+
|
28
|
+
def severity_logged? severity
|
29
|
+
|
30
|
+
$num_BLS_sls += 1
|
31
|
+
|
32
|
+
(0..100).each { |n| n ** n }
|
33
|
+
|
34
|
+
:benchmark == severity.to_s.to_sym
|
35
|
+
end
|
36
|
+
|
37
|
+
def log sev, t, pref, msg
|
38
|
+
|
39
|
+
puts "BENCHMARK: #{pref}#{msg}\n"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
class EventLogService
|
44
|
+
|
45
|
+
def severity_logged? severity
|
46
|
+
|
47
|
+
$num_ELS_sls += 1
|
48
|
+
|
49
|
+
case severity.to_s.to_sym
|
50
|
+
when :notice, :warning, :failure, :critical, :alert, :violation
|
51
|
+
|
52
|
+
true
|
53
|
+
when :warn, :error, :emergency
|
54
|
+
|
55
|
+
true
|
56
|
+
else
|
57
|
+
|
58
|
+
false
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def log sev, t, pref, msg
|
63
|
+
|
64
|
+
puts "EVENTLOG: #{pref}#{msg}\n"
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
scls = Pantheios::Services::SimpleConsoleLogService.new
|
69
|
+
|
70
|
+
def scls.severity_logged? severity; ![ :benchmark, :trace, :violation ].include? severity; end
|
71
|
+
|
72
|
+
services = [
|
73
|
+
|
74
|
+
BenchmarkLogService.new,
|
75
|
+
EventLogService.new,
|
76
|
+
scls,
|
77
|
+
]
|
78
|
+
|
79
|
+
lcm = :none
|
80
|
+
#lcm = :thread_fixed
|
81
|
+
#lcm = :process_fixed
|
82
|
+
unsync = false
|
83
|
+
#unsync = true
|
84
|
+
|
85
|
+
Pantheios::Core.set_service Pantheios::Services::MultiplexingLogService.new(services, level_cache_mode: lcm, unsyc_process_lcm: unsync)
|
86
|
+
|
87
|
+
include Pantheios
|
88
|
+
|
89
|
+
t_b = Time.now
|
90
|
+
|
91
|
+
log :benchmark, 'statement at benchmark'
|
92
|
+
(0..100000).each { log :trace, 'statement at trace' }
|
93
|
+
log :debug4, 'statement at debug-4'
|
94
|
+
log :debug3, 'statement at debug-3'
|
95
|
+
log :debug2, 'statement at debug-2'
|
96
|
+
log :debug1, 'statement at debug-1'
|
97
|
+
log :debug0, 'statement at debug-0'
|
98
|
+
log :informational, 'statement at informational'
|
99
|
+
log :notice, 'statement at notice'
|
100
|
+
log :warning, 'statement at warning'
|
101
|
+
log :failure, 'statement at failure'
|
102
|
+
log :critical, 'statement at critical'
|
103
|
+
log :alert, 'statement at alert'
|
104
|
+
log :violation, 'statement at violation'
|
105
|
+
|
106
|
+
t_a = Time.now
|
107
|
+
|
108
|
+
$stderr.puts "mode= :#{lcm}; t=#{t_a - t_b}; #BLS=#{$num_BLS_sls}; #ELS=#{$num_ELS_sls}"
|
109
|
+
|
@@ -26,12 +26,15 @@ class Test_StockSeverityLevels < Test::Unit::TestCase
|
|
26
26
|
debug2
|
27
27
|
debug3
|
28
28
|
debug4
|
29
|
+
debug5
|
29
30
|
trace
|
31
|
+
benchmark
|
30
32
|
}.map { |s| s.to_sym }
|
31
33
|
|
32
34
|
EXPECTED_LEVELS = %w{
|
33
35
|
|
34
36
|
emergency
|
37
|
+
fail
|
35
38
|
info
|
36
39
|
warn
|
37
40
|
}.map { |s| s.to_sym } + EXPECTED_LEVELS_PRIME
|
@@ -51,6 +54,7 @@ class Test_StockSeverityLevels < Test::Unit::TestCase
|
|
51
54
|
if defined? StockSeverityLevels
|
52
55
|
|
53
56
|
assert StockSeverityLevels.const_defined?(:STOCK_SEVERITY_LEVELS)
|
57
|
+
assert StockSeverityLevels.const_defined?(:STOCK_SEVERITY_LEVELS_PRIME)
|
54
58
|
assert StockSeverityLevels.const_defined?(:STOCK_SEVERITY_LEVEL_VALUES)
|
55
59
|
assert StockSeverityLevels.const_defined?(:STOCK_SEVERITY_LEVEL_STRINGS)
|
56
60
|
end
|
@@ -58,18 +62,36 @@ class Test_StockSeverityLevels < Test::Unit::TestCase
|
|
58
62
|
|
59
63
|
def test_StockSeverityLevels_expected_levels
|
60
64
|
|
65
|
+
# all the ones that we expect exist
|
66
|
+
|
61
67
|
EXPECTED_LEVELS.each do |sev|
|
62
68
|
|
63
69
|
assert(StockSeverityLevels::STOCK_SEVERITY_LEVELS.include?(sev), "did not find level #{::Symbol === sev ? ':' : ''}#{sev} in #{StockSeverityLevels}::STOCK_SEVERITY_LEVELS")
|
64
70
|
end
|
71
|
+
|
72
|
+
# we expect all the ones that exist
|
73
|
+
|
74
|
+
StockSeverityLevels::STOCK_SEVERITY_LEVELS.each do |sev|
|
75
|
+
|
76
|
+
assert(EXPECTED_LEVELS.include?(sev), "found unexpected level #{::Symbol === sev ? ':' : ''}#{sev} in #{StockSeverityLevels}::STOCK_SEVERITY_LEVELS")
|
77
|
+
end
|
65
78
|
end
|
66
79
|
|
67
80
|
def test_StockSeverityLevels_expected_prime_levels
|
68
81
|
|
82
|
+
# all the ones that we expect exist
|
83
|
+
|
69
84
|
EXPECTED_LEVELS_PRIME.each do |sev|
|
70
85
|
|
71
86
|
assert(StockSeverityLevels::STOCK_SEVERITY_LEVELS_PRIME.include?(sev), "did not find level #{::Symbol === sev ? ':' : ''}#{sev} in #{StockSeverityLevels}::STOCK_SEVERITY_LEVELS")
|
72
87
|
end
|
88
|
+
|
89
|
+
# we expect all the ones that exist
|
90
|
+
|
91
|
+
StockSeverityLevels::STOCK_SEVERITY_LEVELS_PRIME.each do |sev|
|
92
|
+
|
93
|
+
assert(EXPECTED_LEVELS_PRIME.include?(sev), "found unexpected level #{::Symbol === sev ? ':' : ''}#{sev} in #{StockSeverityLevels}::STOCK_SEVERITY_LEVELS")
|
94
|
+
end
|
73
95
|
end
|
74
96
|
|
75
97
|
def test_StockSeverityLevels_expected_prime_levels_have_distinct_values
|
@@ -99,5 +121,50 @@ class Test_StockSeverityLevels < Test::Unit::TestCase
|
|
99
121
|
strings[string] = string
|
100
122
|
end
|
101
123
|
end
|
124
|
+
|
125
|
+
def test_StockSeverityLevels_aliases
|
126
|
+
|
127
|
+
aliases = StockSeverityLevels::STOCK_SEVERITY_LEVEL_ALIASES
|
128
|
+
|
129
|
+
assert_equal :violation, aliases[:violation]
|
130
|
+
assert_equal :violation, aliases[:emergency]
|
131
|
+
|
132
|
+
assert_equal :alert, aliases[:alert]
|
133
|
+
|
134
|
+
assert_equal :critical, aliases[:critical]
|
135
|
+
|
136
|
+
assert_equal :failure, aliases[:failure]
|
137
|
+
assert_equal :failure, aliases[:fail]
|
138
|
+
#assert_equal :failure, aliases[:error]
|
139
|
+
|
140
|
+
assert_equal :warning, aliases[:warning]
|
141
|
+
assert_equal :warning, aliases[:warn]
|
142
|
+
|
143
|
+
assert_equal :notice, aliases[:notice]
|
144
|
+
|
145
|
+
assert_equal :informational, aliases[:informational]
|
146
|
+
assert_equal :informational, aliases[:info]
|
147
|
+
|
148
|
+
%i{ debug0 debug1 debug2 debug3 debug4 debug5 }.each do |sev|
|
149
|
+
|
150
|
+
assert_equal sev, aliases[sev]
|
151
|
+
end
|
152
|
+
|
153
|
+
assert_equal :trace, aliases[:trace]
|
154
|
+
|
155
|
+
assert_equal :benchmark, aliases[:benchmark]
|
156
|
+
end
|
157
|
+
|
158
|
+
def test_StockSeverityLevels_recognised_values_are_nil
|
159
|
+
|
160
|
+
EXPECTED_LEVELS.each do |sev|
|
161
|
+
|
162
|
+
assert_not_nil StockSeverityLevels::STOCK_SEVERITY_LEVEL_VALUES[sev]
|
163
|
+
assert_nil StockSeverityLevels::STOCK_SEVERITY_LEVEL_VALUES[sev.to_s]
|
164
|
+
end
|
165
|
+
|
166
|
+
assert_nil StockSeverityLevels::STOCK_SEVERITY_LEVEL_VALUES[nil]
|
167
|
+
assert_nil StockSeverityLevels::STOCK_SEVERITY_LEVEL_VALUES['failure']
|
168
|
+
end
|
102
169
|
end
|
103
170
|
|
@@ -0,0 +1,102 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$:.unshift File.join(File.dirname(__FILE__), '../../..', 'lib')
|
4
|
+
|
5
|
+
require 'pantheios/front_ends/threshold_front_end'
|
6
|
+
|
7
|
+
require 'test/unit'
|
8
|
+
|
9
|
+
class Test_FrontEnds_ThresholdFrontEnd < Test::Unit::TestCase
|
10
|
+
|
11
|
+
include ::Pantheios::FrontEnds
|
12
|
+
|
13
|
+
def test_SimpleConsoleLogService_type_exists
|
14
|
+
|
15
|
+
assert defined? ThresholdFrontEnd
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_construct_with_invalid_parameters
|
19
|
+
|
20
|
+
assert_raise(::TypeError) { ThresholdFrontEnd.new('notice') }
|
21
|
+
|
22
|
+
assert_raise_with_message(::ArgumentError, /unknown threshold severity level.*something_else.*Symbol/) { ThresholdFrontEnd.new(:something_else) }
|
23
|
+
|
24
|
+
ThresholdFrontEnd.new(:notice)
|
25
|
+
ThresholdFrontEnd.new(:notice, value_lookup_map: Hash.new)
|
26
|
+
assert_raise_with_message(::TypeError, /:value_lookup_map must be.*Hash/) { ThresholdFrontEnd.new(:notice, value_lookup_map: Array.new) }
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_default_construct
|
30
|
+
|
31
|
+
fe = ThresholdFrontEnd.new(:notice)
|
32
|
+
|
33
|
+
assert_equal :notice, fe.threshold
|
34
|
+
|
35
|
+
assert_true fe.severity_logged?(:violation)
|
36
|
+
assert_true fe.severity_logged?(:alert)
|
37
|
+
assert_true fe.severity_logged?(:critical)
|
38
|
+
assert_true fe.severity_logged?(:failure)
|
39
|
+
assert_true fe.severity_logged?(:warning)
|
40
|
+
assert_true fe.severity_logged?(:notice)
|
41
|
+
assert_false fe.severity_logged?(:informational)
|
42
|
+
assert_false fe.severity_logged?(:debug0)
|
43
|
+
assert_false fe.severity_logged?(:debug1)
|
44
|
+
assert_false fe.severity_logged?(:debug2)
|
45
|
+
assert_false fe.severity_logged?(:debug3)
|
46
|
+
assert_false fe.severity_logged?(:debug4)
|
47
|
+
assert_false fe.severity_logged?(:debug5)
|
48
|
+
assert_false fe.severity_logged?(:trace)
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_default_construct_and_change_threshold
|
52
|
+
|
53
|
+
fe = ThresholdFrontEnd.new(:notice)
|
54
|
+
|
55
|
+
assert_equal :notice, fe.threshold
|
56
|
+
|
57
|
+
fe.threshold = :failure
|
58
|
+
|
59
|
+
assert_equal :failure, fe.threshold
|
60
|
+
|
61
|
+
assert_true fe.severity_logged?(:violation)
|
62
|
+
assert_true fe.severity_logged?(:alert)
|
63
|
+
assert_true fe.severity_logged?(:critical)
|
64
|
+
assert_true fe.severity_logged?(:failure)
|
65
|
+
assert_false fe.severity_logged?(:warning)
|
66
|
+
assert_false fe.severity_logged?(:notice)
|
67
|
+
assert_false fe.severity_logged?(:informational)
|
68
|
+
assert_false fe.severity_logged?(:debug0)
|
69
|
+
assert_false fe.severity_logged?(:debug1)
|
70
|
+
assert_false fe.severity_logged?(:debug2)
|
71
|
+
assert_false fe.severity_logged?(:debug3)
|
72
|
+
assert_false fe.severity_logged?(:debug4)
|
73
|
+
assert_false fe.severity_logged?(:debug5)
|
74
|
+
assert_false fe.severity_logged?(:trace)
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_use_custom_thresholds
|
78
|
+
|
79
|
+
value_lookup_map = {
|
80
|
+
|
81
|
+
FATAL: 1,
|
82
|
+
ERROR: 2,
|
83
|
+
WARN: 3,
|
84
|
+
INFO: 4,
|
85
|
+
DEBUG: 5,
|
86
|
+
}
|
87
|
+
|
88
|
+
fe = ThresholdFrontEnd.new(:INFO, value_lookup_map: value_lookup_map)
|
89
|
+
|
90
|
+
assert_equal :INFO, fe.threshold
|
91
|
+
|
92
|
+
assert_true fe.severity_logged?(:FATAL)
|
93
|
+
assert_true fe.severity_logged?(:ERROR)
|
94
|
+
assert_true fe.severity_logged?(:WARN)
|
95
|
+
assert_true fe.severity_logged?(:INFO)
|
96
|
+
assert_false fe.severity_logged?(:DEBUG)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
# ############################## end of file ############################# #
|
101
|
+
|
102
|
+
|