pantheios-ruby 0.22.0.2 → 0.22.3
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 +5 -5
- data/AUTHORS.md +21 -0
- data/CHANGES.md +337 -0
- data/CONTRIBUTING.md +36 -0
- data/EXAMPLES.md +11 -0
- data/FAQ.md +28 -0
- data/INSTALL.md +43 -0
- data/LICENSE +21 -20
- data/NEWS.md +65 -0
- data/README.md +134 -2
- data/Rakefile +21 -0
- data/SECURITY.md +23 -0
- data/TODO.md +29 -0
- data/examples/coloured_console_log_service.rb +1 -1
- data/examples/multiple_modules.md +1 -1
- data/examples/multiple_modules.rb +36 -36
- data/examples/simple_logging.md +1 -1
- data/examples/simple_logging.rb +1 -1
- data/examples/threshold_front_end.rb +1 -1
- data/lib/pantheios/api.rb +156 -155
- data/lib/pantheios/application_layer/param_name_list.rb +1 -0
- data/lib/pantheios/application_layer/stock_severity_levels.rb +110 -111
- data/lib/pantheios/application_layer.rb +6 -5
- data/lib/pantheios/core.rb +416 -415
- data/lib/pantheios/front_ends/threshold_front_end.rb +81 -81
- data/lib/pantheios/globals.rb +45 -45
- data/lib/pantheios/services/coloured_console_log_service.rb +96 -96
- data/lib/pantheios/services/common/console.rb +58 -57
- data/lib/pantheios/services/multiplexing_log_service.rb +151 -150
- data/lib/pantheios/services/null_log_service.rb +11 -11
- data/lib/pantheios/services/simple_console_log_service.rb +20 -20
- data/lib/pantheios/services/simple_file_log_service.rb +112 -113
- data/lib/pantheios/services/standard_log_service_adapter.rb +119 -119
- data/lib/pantheios/services.rb +1 -0
- data/lib/pantheios/util/process_util.rb +25 -24
- data/lib/pantheios/util/reflection_util.rb +14 -13
- data/lib/pantheios/util/thread_util.rb +50 -49
- data/lib/pantheios/util/version_util.rb +34 -33
- data/lib/pantheios/util.rb +1 -0
- data/lib/pantheios/version.rb +19 -19
- data/lib/pantheios.rb +12 -12
- data/test/performance/test_perf_simple_statements.rb +58 -58
- data/test/performance/test_perf_trace_variants.rb +43 -57
- data/test/scratch/log_rolling_by_period_daily.rb +3 -3
- data/test/scratch/log_rolling_by_size_and_depth.rb +3 -3
- data/test/scratch/log_using_blocks.rb +12 -12
- data/test/scratch/multiplexing_log_service.rb +32 -32
- data/test/unit/application_layer/tc_param_name_list.rb +13 -13
- data/test/unit/application_layer/tc_stock_severity_levels.rb +102 -102
- data/test/unit/core/tc_core_1.rb +24 -24
- data/test/unit/front_ends/tc_threshold_front_end.rb +65 -65
- data/test/unit/services/tc_multiplexing_log_service.rb +79 -79
- data/test/unit/services/tc_null_log_service.rb +42 -42
- data/test/unit/services/tc_simple_console_log_service.rb +70 -70
- data/test/unit/services/tc_simple_file_log_service.rb +146 -146
- data/test/unit/services/tc_standard_log_service_adapter.rb +94 -96
- data/test/unit/util/tc_process_util.rb +6 -6
- data/test/unit/util/tc_reflection_util.rb +20 -20
- data/test/unit/util/tc_thread_util.rb +46 -46
- data/test/unit/util/tc_version_util.rb +47 -47
- metadata +33 -12
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
2
|
# ######################################################################## #
|
|
3
3
|
# File: lib/pantheios/application_layer/stock_severity_levels.rb
|
|
4
4
|
#
|
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
# namespace module
|
|
8
8
|
#
|
|
9
9
|
# Created: 2nd April 2011
|
|
10
|
-
# Updated:
|
|
10
|
+
# Updated: 28th August 2026
|
|
11
11
|
#
|
|
12
|
-
# Home:
|
|
12
|
+
# Home: https://github.com/synesissoftware/Pantheios.Ruby
|
|
13
13
|
#
|
|
14
14
|
# Author: Matthew Wilson
|
|
15
15
|
#
|
|
16
|
-
# Copyright (c) 2019-
|
|
17
|
-
# Copyright (c) 2011-
|
|
16
|
+
# Copyright (c) 2019-2026, Matthew Wilson and Synesis Information Systems
|
|
17
|
+
# Copyright (c) 2011-2019, Matthew Wilson and Synesis Software
|
|
18
18
|
# All rights reserved.
|
|
19
19
|
#
|
|
20
20
|
# Redistribution and use in source and binary forms, with or without
|
|
@@ -55,158 +55,157 @@ module ApplicationLayer
|
|
|
55
55
|
|
|
56
56
|
module StockSeverityLevels
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
# @!visibility private
|
|
63
|
-
STOCK_SEVERITY_LEVELS_ = {
|
|
58
|
+
private
|
|
59
|
+
# @!visibility private
|
|
60
|
+
module Internal_ # :nodoc: all
|
|
64
61
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
:critical => [ 3, 'Critical', :relative ],
|
|
68
|
-
:failure => [ 4, 'Failure', :relative, [ :fail ] ],
|
|
69
|
-
:warning => [ 5, 'Warning', :relative, [ :warn ] ],
|
|
70
|
-
:notice => [ 6, 'Notice', :relative ],
|
|
71
|
-
:informational => [ 7, 'Informational', :relative, [ :info ] ],
|
|
72
|
-
:debug0 => [ 8, 'Debug-0', :relative ],
|
|
73
|
-
:debug1 => [ 9, 'Debug-1', :relative ],
|
|
74
|
-
:debug2 => [ 10, 'Debug-2', :relative ],
|
|
75
|
-
:debug3 => [ 11, 'Debug-3', :relative ],
|
|
76
|
-
:debug4 => [ 12, 'Debug-4', :relative ],
|
|
77
|
-
:debug5 => [ 13, 'Debug-5', :relative ],
|
|
78
|
-
:trace => [ 15, 'Trace', :relative ],
|
|
79
|
-
:benchmark => [ 16, 'Benchmark', :separate ],
|
|
80
|
-
}
|
|
62
|
+
# @!visibility private
|
|
63
|
+
STOCK_SEVERITY_LEVELS_ = {
|
|
81
64
|
|
|
82
|
-
|
|
83
|
-
|
|
65
|
+
:violation => [ 1, 'Violation', :relative, [ :emergency ] ],
|
|
66
|
+
:alert => [ 2, 'Alert', :relative ],
|
|
67
|
+
:critical => [ 3, 'Critical', :relative ],
|
|
68
|
+
:failure => [ 4, 'Failure', :relative, [ :fail ] ],
|
|
69
|
+
:warning => [ 5, 'Warning', :relative, [ :warn ] ],
|
|
70
|
+
:notice => [ 6, 'Notice', :relative ],
|
|
71
|
+
:informational => [ 7, 'Informational', :relative, [ :info ] ],
|
|
72
|
+
:debug0 => [ 8, 'Debug-0', :relative ],
|
|
73
|
+
:debug1 => [ 9, 'Debug-1', :relative ],
|
|
74
|
+
:debug2 => [ 10, 'Debug-2', :relative ],
|
|
75
|
+
:debug3 => [ 11, 'Debug-3', :relative ],
|
|
76
|
+
:debug4 => [ 12, 'Debug-4', :relative ],
|
|
77
|
+
:debug5 => [ 13, 'Debug-5', :relative ],
|
|
78
|
+
:trace => [ 15, 'Trace', :relative ],
|
|
79
|
+
:benchmark => [ 16, 'Benchmark', :separate ],
|
|
80
|
+
}
|
|
84
81
|
|
|
85
|
-
|
|
82
|
+
# @!visibility private
|
|
83
|
+
def self.create_level_keys m # :nodoc:
|
|
86
84
|
|
|
87
|
-
|
|
85
|
+
r = m.keys
|
|
88
86
|
|
|
89
|
-
|
|
87
|
+
m.each do |k, ar|
|
|
90
88
|
|
|
91
|
-
|
|
92
|
-
end
|
|
93
|
-
end
|
|
89
|
+
(ar[3] || []).each do |al|
|
|
94
90
|
|
|
95
|
-
|
|
96
|
-
|
|
91
|
+
r << al
|
|
92
|
+
end
|
|
93
|
+
end
|
|
97
94
|
|
|
98
|
-
|
|
99
|
-
|
|
95
|
+
r.uniq
|
|
96
|
+
end
|
|
100
97
|
|
|
101
|
-
|
|
98
|
+
# @!visibility private
|
|
99
|
+
def self.create_level_value_map m # :nodoc:
|
|
102
100
|
|
|
103
|
-
|
|
101
|
+
r = {}
|
|
104
102
|
|
|
105
|
-
|
|
106
|
-
warn 'invalid start-up' unless ::Array === ar
|
|
103
|
+
m.each do |sev, ar|
|
|
107
104
|
|
|
108
|
-
|
|
105
|
+
warn 'invalid start-up' unless ::Symbol === sev
|
|
106
|
+
warn 'invalid start-up' unless ::Array === ar
|
|
109
107
|
|
|
110
|
-
|
|
111
|
-
end
|
|
112
|
-
end
|
|
108
|
+
([sev] + (ar[3] || [])).each do |al|
|
|
113
109
|
|
|
114
|
-
|
|
115
|
-
|
|
110
|
+
r[al] = ar[0]
|
|
111
|
+
end
|
|
112
|
+
end
|
|
116
113
|
|
|
117
|
-
|
|
118
|
-
|
|
114
|
+
r
|
|
115
|
+
end
|
|
119
116
|
|
|
120
|
-
|
|
117
|
+
# @!visibility private
|
|
118
|
+
def self.create_level_string_map m # :nodoc:
|
|
121
119
|
|
|
122
|
-
|
|
120
|
+
r = {}
|
|
123
121
|
|
|
124
|
-
|
|
125
|
-
warn 'invalid start-up' unless ::Array === ar
|
|
122
|
+
m.each do |sev, ar|
|
|
126
123
|
|
|
127
|
-
|
|
124
|
+
warn 'invalid start-up' unless ::Symbol === sev
|
|
125
|
+
warn 'invalid start-up' unless ::Array === ar
|
|
128
126
|
|
|
129
|
-
|
|
127
|
+
s = ar[1].dup
|
|
128
|
+
s.define_singleton_method(:severity) { sev }
|
|
130
129
|
|
|
131
|
-
|
|
130
|
+
([sev] + (ar[3] || [])).each do |al|
|
|
132
131
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
132
|
+
r[al] = s
|
|
133
|
+
end
|
|
134
|
+
end
|
|
136
135
|
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
r
|
|
137
|
+
end
|
|
139
138
|
|
|
140
|
-
|
|
141
|
-
|
|
139
|
+
# @!visibility private
|
|
140
|
+
def self.create_level_aliases m # :nodoc:
|
|
142
141
|
|
|
143
|
-
|
|
142
|
+
r = {}
|
|
144
143
|
|
|
145
|
-
|
|
144
|
+
m.each do |sev, ar|
|
|
146
145
|
|
|
147
|
-
|
|
148
|
-
|
|
146
|
+
warn 'invalid start-up' unless ::Symbol === sev
|
|
147
|
+
warn 'invalid start-up' unless ::Array === ar
|
|
149
148
|
|
|
150
|
-
|
|
149
|
+
([sev] + (ar[3] || [])).each do |al|
|
|
151
150
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
151
|
+
r[al] = sev
|
|
152
|
+
end
|
|
153
|
+
end
|
|
155
154
|
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
r
|
|
156
|
+
end
|
|
158
157
|
|
|
159
|
-
|
|
160
|
-
|
|
158
|
+
# @!visibility private
|
|
159
|
+
def self.create_level_relative_map m # :nodoc:
|
|
161
160
|
|
|
162
|
-
|
|
161
|
+
r = {}
|
|
163
162
|
|
|
164
|
-
|
|
163
|
+
m.each do |sev, ar|
|
|
165
164
|
|
|
166
|
-
|
|
167
|
-
|
|
165
|
+
warn 'invalid start-up' unless ::Symbol === sev
|
|
166
|
+
warn 'invalid start-up' unless ::Array === ar
|
|
168
167
|
|
|
169
|
-
|
|
168
|
+
relativity = ar[2]
|
|
170
169
|
|
|
171
|
-
|
|
172
|
-
|
|
170
|
+
case relativity
|
|
171
|
+
when :relative
|
|
173
172
|
|
|
174
|
-
|
|
173
|
+
([sev] + (ar[3] || [])).each do |al|
|
|
175
174
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
175
|
+
r[al] = relativity
|
|
176
|
+
end
|
|
177
|
+
else
|
|
179
178
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
179
|
+
;
|
|
180
|
+
end
|
|
181
|
+
end
|
|
183
182
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
183
|
+
r
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
public
|
|
188
187
|
|
|
189
|
-
|
|
190
|
-
|
|
188
|
+
# Ordered list of stock severity level symbols, without any aliases
|
|
189
|
+
STOCK_SEVERITY_LEVELS_PRIME = Internal_::STOCK_SEVERITY_LEVELS_.keys
|
|
191
190
|
|
|
192
|
-
|
|
193
|
-
|
|
191
|
+
# Unordered list of stock severity levels, some of which may be aliases
|
|
192
|
+
STOCK_SEVERITY_LEVELS = Internal_.create_level_keys Internal_::STOCK_SEVERITY_LEVELS_
|
|
194
193
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
194
|
+
# Mapping of severity level aliases - with may be symbols and strings -
|
|
195
|
+
# to the prime stock severity level symbols
|
|
196
|
+
STOCK_SEVERITY_LEVEL_ALIASES = Internal_.create_level_aliases Internal_::STOCK_SEVERITY_LEVELS_
|
|
198
197
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
198
|
+
# Mapping of severity level aliases - with may be symbols and strings -
|
|
199
|
+
# containing only those levels that are relative, i.e. may participate
|
|
200
|
+
# meaningfully in a threshold-based filtering
|
|
201
|
+
STOCK_SEVERITY_LEVELS_RELATIVE = Internal_.create_level_relative_map Internal_::STOCK_SEVERITY_LEVELS_
|
|
203
202
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
203
|
+
# Mapping of severity level (and level alias) symbols to integral
|
|
204
|
+
# equivalent
|
|
205
|
+
STOCK_SEVERITY_LEVEL_VALUES = Internal_.create_level_value_map Internal_::STOCK_SEVERITY_LEVELS_
|
|
207
206
|
|
|
208
|
-
|
|
209
|
-
|
|
207
|
+
# Mapping of severity level (and level alias) symbols to string
|
|
208
|
+
STOCK_SEVERITY_LEVEL_STRINGS = Internal_.create_level_string_map Internal_::STOCK_SEVERITY_LEVELS_
|
|
210
209
|
|
|
211
210
|
end # module StockSeverityLevels
|
|
212
211
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
|
|
2
3
|
require 'pantheios/application_layer/param_name_list'
|
|
3
4
|
require 'pantheios/application_layer/stock_severity_levels'
|
|
@@ -7,13 +8,13 @@ require 'pantheios/core'
|
|
|
7
8
|
module Pantheios
|
|
8
9
|
module ApplicationLayer
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
# @!visibility private
|
|
12
|
+
def self.included receiver # :nodoc:
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
receiver.extend self
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
::Pantheios::Core.register_include self, receiver
|
|
17
|
+
end
|
|
17
18
|
|
|
18
19
|
end # module ApplicationLayer
|
|
19
20
|
end # module Pantheios
|