pantheios-ruby 0.20.2 → 0.22.0.2
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/examples/threshold_front_end.rb +48 -0
- data/lib/pantheios.rb +3 -2
- data/lib/pantheios/api.rb +23 -6
- data/lib/pantheios/application_layer.rb +2 -1
- data/lib/pantheios/application_layer/param_name_list.rb +9 -0
- data/lib/pantheios/application_layer/stock_severity_levels.rb +99 -31
- data/lib/pantheios/core.rb +55 -24
- data/lib/pantheios/front_ends/threshold_front_end.rb +148 -0
- data/lib/pantheios/globals.rb +20 -9
- 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 +42 -3
- data/lib/pantheios/services/null_log_service.rb +3 -2
- data/lib/pantheios/services/simple_console_log_service.rb +4 -3
- data/lib/pantheios/services/simple_file_log_service.rb +3 -4
- data/lib/pantheios/services/standard_log_service_adapter.rb +3 -2
- data/lib/pantheios/util/process_util.rb +3 -3
- data/lib/pantheios/util/reflection_util.rb +3 -0
- data/lib/pantheios/util/thread_util.rb +2 -0
- data/lib/pantheios/util/version_util.rb +1 -0
- data/lib/pantheios/version.rb +3 -2
- 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 +4 -4
- metadata +21 -7
@@ -6,12 +6,13 @@
|
|
6
6
|
# ::Pantheios::Services::MultiplexingLogService 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,10 +57,11 @@ 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 MultiplexingLogService
|
61
62
|
|
62
|
-
|
63
|
+
# @!visibility private
|
64
|
+
module MultiplexingLogService_Internals_ # :nodoc: all
|
63
65
|
|
64
66
|
class ServiceManagementInfo
|
65
67
|
|
@@ -167,6 +169,43 @@ class MultiplexingLogService
|
|
167
169
|
end
|
168
170
|
public
|
169
171
|
|
172
|
+
# Indicates whether any of the services require a prefix and, if so,
|
173
|
+
# what it may require
|
174
|
+
#
|
175
|
+
# === Return
|
176
|
+
# (+false+, +true+, +:parts+) An indicator what the most needy of the
|
177
|
+
# multiplexed services requires
|
178
|
+
def requires_prefix?
|
179
|
+
|
180
|
+
return @requires_prefix unless @requires_prefix.nil?
|
181
|
+
|
182
|
+
requires_prefix = false
|
183
|
+
|
184
|
+
@services.each do |svc|
|
185
|
+
|
186
|
+
if svc.respond_to? :requires_prefix?
|
187
|
+
|
188
|
+
case rp = svc.requires_prefix?
|
189
|
+
when nil, false
|
190
|
+
|
191
|
+
;
|
192
|
+
when true
|
193
|
+
|
194
|
+
requires_prefix ||= true
|
195
|
+
when :parts
|
196
|
+
|
197
|
+
requires_prefix = rp
|
198
|
+
break
|
199
|
+
else
|
200
|
+
|
201
|
+
warn "unrecognised return from requires_prefix? for service #{svc}: #{rp} (#{rp.class})"
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
@requires_prefix = requires_prefix
|
207
|
+
end
|
208
|
+
|
170
209
|
# Indicates whether the given severity is to be logged by any of the
|
171
210
|
# multiplexed log services
|
172
211
|
def severity_logged? severity
|
@@ -6,12 +6,13 @@
|
|
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
|
#
|
@@ -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 SimpleConsoleLogService
|
61
62
|
|
62
63
|
def severity_logged? severity
|
@@ -80,7 +81,7 @@ class SimpleConsoleLogService
|
|
80
81
|
|
81
82
|
$stderr
|
82
83
|
end
|
83
|
-
end
|
84
|
+
end # class SimpleConsoleLogService
|
84
85
|
|
85
86
|
end # module Services
|
86
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
|
@@ -94,8 +95,6 @@ class SimpleFileLogService
|
|
94
95
|
# - +:roll_depth+:: [ ::Integer ] The depth of the size-based log
|
95
96
|
# rolling. Overrides the second element in an array specified for
|
96
97
|
# +:roll_size+
|
97
|
-
|
98
|
-
|
99
98
|
def initialize log_file_or_path, **options
|
100
99
|
|
101
100
|
roll_period = options[:roll_period]
|
@@ -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
|
@@ -2,13 +2,13 @@
|
|
2
2
|
module Pantheios
|
3
3
|
module Util
|
4
4
|
|
5
|
+
# process utilities
|
5
6
|
module ProcessUtil
|
6
7
|
|
7
8
|
#
|
8
9
|
# * *Options:*
|
9
|
-
# - +:style+:: (:script, :script_basename, :script_dirname,
|
10
|
-
#
|
11
|
-
# name. If none specified, :script_stem is assumed
|
10
|
+
# - +:style+:: (:script, :script_basename, :script_dirname, :script_realpath, :script_stem) directs
|
11
|
+
# the inference of the process name. If none specified, :script_stem is assumed
|
12
12
|
def self.derive_process_name dollar0 = nil, **options
|
13
13
|
|
14
14
|
dollar0 ||= $0
|
@@ -2,6 +2,7 @@
|
|
2
2
|
module Pantheios
|
3
3
|
module Util
|
4
4
|
|
5
|
+
# reflection utilities
|
5
6
|
module ReflectionUtil
|
6
7
|
|
7
8
|
module ReflectionUtil_Constants
|
@@ -9,6 +10,8 @@ module ReflectionUtil
|
|
9
10
|
ROOT_CLASSES = [ ::Object, ::BasicObject ]
|
10
11
|
end
|
11
12
|
|
13
|
+
# Obtains a list of all classes pertaining to +o+, excepting root
|
14
|
+
# objects (+::Object+ and +::BaseObject+).
|
12
15
|
def self.non_root_classes o
|
13
16
|
|
14
17
|
return [] if o.nil?
|
@@ -2,6 +2,7 @@
|
|
2
2
|
module Pantheios
|
3
3
|
module Util
|
4
4
|
|
5
|
+
# threading utilities
|
5
6
|
module ThreadUtil
|
6
7
|
|
7
8
|
# Creates (if necessary) and sets the given thread's +thread_name+
|
@@ -22,6 +23,7 @@ module ThreadUtil
|
|
22
23
|
t.thread_name = name
|
23
24
|
end
|
24
25
|
|
26
|
+
# Obtains the name of the calling thread
|
25
27
|
def self.get_thread_name t
|
26
28
|
|
27
29
|
t ||= Thread.current
|
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: 5th 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.2'
|
54
55
|
|
55
56
|
private
|
56
57
|
VERSION_PARTS_ = VERSION.split(/[.]/).collect { |n| n.to_i } # :nodoc:
|
@@ -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
|
+
|