pantheios-ruby 0.18.1 → 0.21.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.
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), *([ '..' ] * 1), 'lib')
4
+
5
+ # requires (0)
6
+
7
+ require 'pantheios/globals'
8
+
9
+ # globals
10
+
11
+ Pantheios::Globals.MAIN_THREAD_NAME = [ Thread.current, 'main' ]
12
+ Pantheios::Globals.PROCESS_NAME = :script_stem
13
+
14
+ # requires (1)
15
+
16
+ require 'pantheios'
17
+
18
+ # includes
19
+
20
+ include ::Pantheios
21
+
22
+ # constants
23
+
24
+ LEVELS = %i{ violation alert critical failure warning notice informational debug0 debug1 debug2 debug3 debug4 }
25
+
26
+ # main
27
+
28
+ LEVELS.each do |level|
29
+
30
+ log(level, "logging level #{level}")
31
+ end
32
+
33
+ # ############################## end of file ############################# #
34
+
35
+
@@ -7,12 +7,13 @@
7
7
  # namespace module
8
8
  #
9
9
  # Created: 2nd April 2011
10
- # Updated: 6th January 2018
10
+ # Updated: 3rd June 2020
11
11
  #
12
12
  # Home: http://github.com/synesissoftware/Pantheios-Ruby
13
13
  #
14
14
  # Author: Matthew Wilson
15
15
  #
16
+ # Copyright (c) 2019-2020, Matthew Wilson and Synesis Information Systems
16
17
  # Copyright (c) 2011-2018, Matthew Wilson and Synesis Software
17
18
  # All rights reserved.
18
19
  #
@@ -59,20 +60,21 @@ module StockSeverityLevels
59
60
 
60
61
  STOCK_SEVERITY_LEVELS_ = {
61
62
 
62
- :violation => [ 1, 'Violation', [ :emergency ] ],
63
- :alert => [ 2, 'Alert' ],
64
- :critical => [ 3, 'Critical' ],
65
- :failure => [ 4, 'Failure' ],
66
- :warning => [ 5, 'Warning', [ :warn ] ],
67
- :notice => [ 6, 'Notice' ],
68
- :informational => [ 7, 'Informational', [ :info ] ],
69
- :debug0 => [ 8, 'Debug-0' ],
70
- :debug1 => [ 9, 'Debug-1' ],
71
- :debug2 => [ 10, 'Debug-2' ],
72
- :debug3 => [ 11, 'Debug-3' ],
73
- :debug4 => [ 12, 'Debug-4' ],
74
- :trace => [ 13, 'Trace' ],
75
- :benchmark => [ 14, 'Benchmark' ],
63
+ :violation => [ 1, 'Violation', :relative, [ :emergency ] ],
64
+ :alert => [ 2, 'Alert', :relative ],
65
+ :critical => [ 3, 'Critical', :relative ],
66
+ :failure => [ 4, 'Failure', :relative, [ :fail ] ],
67
+ :warning => [ 5, 'Warning', :relative, [ :warn ] ],
68
+ :notice => [ 6, 'Notice', :relative ],
69
+ :informational => [ 7, 'Informational', :relative, [ :info ] ],
70
+ :debug0 => [ 8, 'Debug-0', :relative ],
71
+ :debug1 => [ 9, 'Debug-1', :relative ],
72
+ :debug2 => [ 10, 'Debug-2', :relative ],
73
+ :debug3 => [ 11, 'Debug-3', :relative ],
74
+ :debug4 => [ 12, 'Debug-4', :relative ],
75
+ :debug5 => [ 13, 'Debug-5', :relative ],
76
+ :trace => [ 15, 'Trace', :relative ],
77
+ :benchmark => [ 16, 'Benchmark', :separate ],
76
78
  }
77
79
 
78
80
  def self.create_level_keys m
@@ -81,7 +83,7 @@ module StockSeverityLevels
81
83
 
82
84
  m.each do |k, ar|
83
85
 
84
- (ar[2] || []).each do |al|
86
+ (ar[3] || []).each do |al|
85
87
 
86
88
  r << al
87
89
  end
@@ -99,7 +101,7 @@ module StockSeverityLevels
99
101
  warn 'invalid start-up' unless ::Symbol === s
100
102
  warn 'invalid start-up' unless ::Array === ar
101
103
 
102
- ([s] + (ar[2] || [])).each do |al|
104
+ ([s] + (ar[3] || [])).each do |al|
103
105
 
104
106
  r[al] = ar[0]
105
107
  end
@@ -107,6 +109,7 @@ module StockSeverityLevels
107
109
 
108
110
  r
109
111
  end
112
+
110
113
  def self.create_level_string_map m
111
114
 
112
115
  r = {}
@@ -116,7 +119,7 @@ module StockSeverityLevels
116
119
  warn 'invalid start-up' unless ::Symbol === s
117
120
  warn 'invalid start-up' unless ::Array === ar
118
121
 
119
- ([s] + (ar[2] || [])).each do |al|
122
+ ([s] + (ar[3] || [])).each do |al|
120
123
 
121
124
  r[al] = ar[1]
122
125
  end
@@ -124,20 +127,74 @@ module StockSeverityLevels
124
127
 
125
128
  r
126
129
  end
130
+
131
+ def self.create_level_aliases m
132
+
133
+ r = {}
134
+
135
+ m.each do |s, ar|
136
+
137
+ warn 'invalid start-up' unless ::Symbol === s
138
+ warn 'invalid start-up' unless ::Array === ar
139
+
140
+ ([s] + (ar[3] || [])).each do |al|
141
+
142
+ r[al] = s
143
+ end
144
+ end
145
+
146
+ r
147
+ end
148
+
149
+ def self.create_level_relative_map m
150
+
151
+ r = {}
152
+
153
+ m.each do |s, ar|
154
+
155
+ warn 'invalid start-up' unless ::Symbol === s
156
+ warn 'invalid start-up' unless ::Array === ar
157
+
158
+ relativity = ar[2]
159
+
160
+ case relativity
161
+ when :relative
162
+
163
+ ([s] + (ar[3] || [])).each do |al|
164
+
165
+ r[al] = relativity
166
+ end
167
+ else
168
+
169
+ ;
170
+ end
171
+ end
172
+
173
+ r
174
+ end
127
175
  end
128
176
  public
129
177
 
130
- # Ordered list of stock severity levels, without any aliases
178
+ # Ordered list of stock severity level symbols, without any aliases
131
179
  STOCK_SEVERITY_LEVELS_PRIME = Internal_::STOCK_SEVERITY_LEVELS_.keys
132
180
 
133
- # Ordered list of stock severity levels, some of which may be aliases
181
+ # Unordered list of stock severity levels, some of which may be aliases
134
182
  STOCK_SEVERITY_LEVELS = Internal_.create_level_keys Internal_::STOCK_SEVERITY_LEVELS_
135
183
 
136
- # Mapping of severity levels (and level aliases) to integral
184
+ # Mapping of severity level aliases - with may be symbols and strings -
185
+ # to the prime stock severity level symbols
186
+ STOCK_SEVERITY_LEVEL_ALIASES = Internal_.create_level_aliases Internal_::STOCK_SEVERITY_LEVELS_
187
+
188
+ # Mapping of severity level aliases - with may be symbols and strings -
189
+ # containing only those levels that are relative, i.e. may participate
190
+ # meaningfully in a threshold-based filtering
191
+ STOCK_SEVERITY_LEVELS_RELATIVE = Internal_.create_level_relative_map Internal_::STOCK_SEVERITY_LEVELS_
192
+
193
+ # Mapping of severity level (and level alias) symbols to integral
137
194
  # equivalent
138
195
  STOCK_SEVERITY_LEVEL_VALUES = Internal_.create_level_value_map Internal_::STOCK_SEVERITY_LEVELS_
139
196
 
140
- # Mapping of severity levels (and level aliases) to string
197
+ # Mapping of severity level (and level alias) symbols to string
141
198
  STOCK_SEVERITY_LEVEL_STRINGS = Internal_.create_level_string_map Internal_::STOCK_SEVERITY_LEVELS_
142
199
 
143
200
  end # module StockSeverityLevels
@@ -5,7 +5,7 @@
5
5
  # Purpose: The Pantheios.Ruby core (::Pantheios::Core)
6
6
  #
7
7
  # Created: 2nd April 2011
8
- # Updated: 5th February 2018
8
+ # Updated: 5th September 2018
9
9
  #
10
10
  # Home: http://github.com/synesissoftware/Pantheios-Ruby
11
11
  #
@@ -506,7 +506,7 @@ module Core
506
506
 
507
507
  if block_given?
508
508
 
509
- br = get_block_value_ &block
509
+ br = get_block_value_(&block)
510
510
 
511
511
  if ApplicationLayer::ParamNameList === br
512
512
 
@@ -527,20 +527,21 @@ module Core
527
527
  end
528
528
  end
529
529
 
530
+ fl = nil
531
+ rx = nil
532
+ fn = caller(call_depth + 1, 1)[0]
533
+
530
534
  case param_list
531
535
  when nil
532
536
  ;
533
537
  when ApplicationLayer::ParamNameList
534
- ;
538
+
539
+ warn "#{fn}: param_list must contain only strings or symbols" unless param_list.all? { |p| p.kind_of?(::String) || p.kind_of?(::Symbol) }
535
540
  else
536
541
 
537
- warn "param_list (#{param_list.class}) must be nil or an instance of #{ApplicationLayer::ParamNameList}" unless param_list
542
+ warn "#{fn}: param_list (#{param_list.class}) must be nil or an instance of #{ApplicationLayer::ParamNameList}" unless param_list
538
543
  end
539
544
 
540
- fl = nil
541
- rx = nil
542
- fn = caller(call_depth + 1, 1)[0]
543
-
544
545
  if ::Class === prefix_provider
545
546
 
546
547
  rx = "#{prefix_provider}::"
@@ -0,0 +1,135 @@
1
+
2
+ # ######################################################################## #
3
+ # File: lib/pantheios/front_ends/threshold_front_end.rb
4
+ #
5
+ # Purpose: Definition of the ::Pantheios::FrontEnds::ThresholdFrontEnd
6
+ # class
7
+ #
8
+ # Created: 3rd June 2020
9
+ # Updated: 3rd June 2020
10
+ #
11
+ # Home: http://github.com/synesissoftware/Pantheios-Ruby
12
+ #
13
+ # Author: Matthew Wilson
14
+ #
15
+ # Copyright (c) 2020, Matthew Wilson and Synesis Information Systems
16
+ # All rights reserved.
17
+ #
18
+ # Redistribution and use in source and binary forms, with or without
19
+ # modification, are permitted provided that the following conditions are
20
+ # met:
21
+ #
22
+ # * Redistributions of source code must retain the above copyright
23
+ # notice, this list of conditions and the following disclaimer.
24
+ #
25
+ # * Redistributions in binary form must reproduce the above copyright
26
+ # notice, this list of conditions and the following disclaimer in the
27
+ # documentation and/or other materials provided with the distribution.
28
+ #
29
+ # * Neither the names of the copyright holder nor the names of its
30
+ # contributors may be used to endorse or promote products derived from
31
+ # this software without specific prior written permission.
32
+ #
33
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
34
+ # IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
35
+ # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
36
+ # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
37
+ # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
38
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
39
+ # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
40
+ # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
41
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
42
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
43
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44
+ #
45
+ # ######################################################################## #
46
+
47
+
48
+ =begin
49
+ =end
50
+
51
+ require 'pantheios/application_layer/stock_severity_levels'
52
+
53
+ module Pantheios
54
+ module FrontEnds
55
+
56
+ # A class that fulfils the Pantheios *FrontEnd* protocol that implements
57
+ # +severity_logged?+ based on a threshold specified to the initialiser
58
+ #
59
+ # NOTE: The *FrontEnd* protocol is implemented by a class that provides
60
+ # the instance method +severity_logged?(severity : Object)+
61
+ class ThresholdFrontEnd
62
+
63
+ include ::Pantheios::ApplicationLayer
64
+
65
+ # Initialises the instance
66
+ #
67
+ # === Signature
68
+ #
69
+ # * *Parameters:*
70
+ # - +threshold_severity+ [ ::Symbol ] The threshold severity
71
+ #
72
+ # * *Options:*
73
+ # - +value_lookup_map+ [ ::Hash ] A map that is used to lookup
74
+ # +severity+ values (that are not +::Integer+) in
75
+ # +severity_logged?+. May be +nil+, in which case
76
+ # +::Pantheios::ApplicationLayer::StockSeverityLevels::STOCK_SEVERITY_LEVEL_VALUES+
77
+ # is used
78
+ def initialize(threshold_severity, **options)
79
+
80
+ m = options[:value_lookup_map]
81
+
82
+ raise TypeError, "value given for :value_lookup_map must be a #{::Hash}" if m && !m.respond_to?(:to_hash)
83
+
84
+ if m
85
+
86
+ @value_lookup_map = m
87
+ @relativity_lookup_map = ::Hash.new(:relative)
88
+ else
89
+
90
+ @value_lookup_map = StockSeverityLevels::STOCK_SEVERITY_LEVEL_VALUES
91
+ @relativity_lookup_map = StockSeverityLevels::STOCK_SEVERITY_LEVELS_RELATIVE
92
+ end
93
+
94
+ self.threshold = threshold_severity
95
+ end
96
+
97
+ def severity_logged? severity
98
+
99
+ case severity
100
+ when ::Integer
101
+
102
+ v = severity
103
+ else
104
+
105
+ v = @value_lookup_map[severity] or warn "unknown severity level '#{severity}' (#{severity.class})"
106
+ end
107
+
108
+ return true if v.nil?
109
+
110
+ v <= @threshold_v
111
+ end
112
+
113
+ # assigns the threshold
114
+ #
115
+ # * *Parameters:*
116
+ # - +threshold_severity+ [ ::Symbol ] The threshold severity
117
+ def threshold=(threshold_severity)
118
+
119
+ raise TypeError, "threshold_severity must be a #{::Symbol}" unless ::Symbol === threshold_severity
120
+
121
+ @threshold_v = @value_lookup_map[threshold_severity] if @relativity_lookup_map[threshold_severity] or raise ArgumentError, "unknown threshold severity level '#{threshold_severity}' (#{threshold_severity.class})"
122
+ @threshold = threshold_severity
123
+
124
+ nil
125
+ end
126
+ attr_reader :threshold
127
+
128
+ end # class ThresholdFrontEnd
129
+
130
+ end # module FrontEnds
131
+ end # module Pantheios
132
+
133
+ # ############################## end of file ############################# #
134
+
135
+
@@ -5,12 +5,13 @@
5
5
  # Purpose: The Pantheios.Ruby "globals" (::Pantheios::Globals)
6
6
  #
7
7
  # Created: 24th December 2017
8
- # Updated: 4th February 2018
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) 2017-2018, Matthew Wilson and Synesis Software
15
16
  # All rights reserved.
16
17
  #
@@ -57,6 +58,18 @@ module Pantheios
57
58
  #
58
59
  # === Variables
59
60
  #
61
+ # * *HAS_CASCADED_INCLUDES* [boolean] Determines whether including
62
+ # +::Pantheios+ also includes all relevant parts of subordinate
63
+ # namespaces. See the documentation for the +::Pantheios+ namespace for
64
+ # further details
65
+ #
66
+ # * *INITIAL_SERVICE_CLASSES* [ svc-class, [ svc-class ] ] Specifies
67
+ # the service class(es) that will be used to create the initial service
68
+ # instance. Ignored if INITIAL_SERVICE_INSTANCES specifies an instance
69
+ #
70
+ # * *INITIAL_SERVICE_INSTANCES* [ svc-instance, [ svc-instance ] ] Specifies
71
+ # the initial service instance
72
+ #
60
73
  # * *MAIN_THREAD_NAME* A string specifying the main thread name, or an array
61
74
  # containing a thread instance and a string specifying the thread and its
62
75
  # name
@@ -65,11 +78,6 @@ module Pantheios
65
78
  # form is used then the first initialising thread of Pantheios.Ruby will
66
79
  # be the named thread
67
80
  #
68
- # * *HAS_CASCADED_INCLUDES* [boolean] Determines whether including
69
- # +::Pantheios+ also includes all relevant parts of subordinate
70
- # namespaces. See the documentation for the +::Pantheios+ namespace for
71
- # further details
72
- #
73
81
  # * *PROCESS_NAME* A string specifying the process name, or one of the
74
82
  # recognised symbols - :script, :script_basename, :script_dirname,
75
83
  # :script_realpath, :script_stem - that directs inference of the process
@@ -0,0 +1,3 @@
1
+
2
+ Dir[File.join(File.dirname(__FILE__), 'services', '*log_service.rb')].each { |f| require f }
3
+
@@ -0,0 +1,239 @@
1
+
2
+ # ######################################################################## #
3
+ # File: lib/pantheios/services/multiplexing_log_service.rb
4
+ #
5
+ # Purpose: Definition of the
6
+ # ::Pantheios::Services::MultiplexingLogService class
7
+ #
8
+ # Created: 14th June 2015
9
+ # Updated: 8th February 2018
10
+ #
11
+ # Home: http://github.com/synesissoftware/Pantheios-Ruby
12
+ #
13
+ # Author: Matthew Wilson
14
+ #
15
+ # Copyright (c) 2015-2018, Matthew Wilson and Synesis Software
16
+ # All rights reserved.
17
+ #
18
+ # Redistribution and use in source and binary forms, with or without
19
+ # modification, are permitted provided that the following conditions are
20
+ # met:
21
+ #
22
+ # * Redistributions of source code must retain the above copyright
23
+ # notice, this list of conditions and the following disclaimer.
24
+ #
25
+ # * Redistributions in binary form must reproduce the above copyright
26
+ # notice, this list of conditions and the following disclaimer in the
27
+ # documentation and/or other materials provided with the distribution.
28
+ #
29
+ # * Neither the names of the copyright holder nor the names of its
30
+ # contributors may be used to endorse or promote products derived from
31
+ # this software without specific prior written permission.
32
+ #
33
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
34
+ # IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
35
+ # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
36
+ # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
37
+ # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
38
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
39
+ # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
40
+ # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
41
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
42
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
43
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44
+ #
45
+ # ######################################################################## #
46
+
47
+
48
+ =begin
49
+ =end
50
+
51
+ module Pantheios
52
+ module Services
53
+
54
+ # A class that fulfils the Pantheios *LogService* protocol by multiplexing
55
+ # its responsibilities to a number of (concrete) log service instances
56
+ #
57
+ # NOTE: The *LogService* protocol is implemented by a class that provides
58
+ # the instance methods +severity_logged?(severity : Object) : boolean+ and
59
+ # +log(severity : Object, t : Time, prefix : String, msg : String)+
60
+ class MultiplexingLogService
61
+
62
+ module MultiplexingLogService_Internals_
63
+
64
+ class ServiceManagementInfo
65
+
66
+ def initialize svc
67
+
68
+ @service = svc
69
+ end
70
+
71
+ attr_reader :service
72
+ end
73
+ end
74
+
75
+ # Initializes the instance with an array of log services, according to
76
+ # the given options
77
+ #
78
+ # ===Signature
79
+ #
80
+ # * *Parameters:*
81
+ # - +services+:: [ ::Array ] An array of instances that observe the
82
+ # Log Service protocol
83
+ # - +options+:: [ ::Hash] options
84
+ #
85
+ # * *Options:*
86
+ # - +:level_cache_mode+:: [ ::Symbol ] Specifies the mode of severity
87
+ # level caching, and must be one of the following values:
88
+ # * +:none+:: no severity level caching is performed. This is the
89
+ # default because it is completely thread-safe, but it is the
90
+ # slowest mode, and users are advised to specify another mode
91
+ # suitable to their use
92
+ # * +:thread_fixed+:: remembers the response of each multiplexed log
93
+ # service to each severity level on a thread-specific basis
94
+ # * +:process_fixed+:: remembers the response of each multiplexed
95
+ # log service to each severity level and then remembers that for
96
+ # the duration of the lifetime of the instance
97
+ # - +:unsync_process_lcm+:: [ boolean ] If truey, causes
98
+ # +:process_fixed+ +:level_cache_mode+ to NOT be synchronised; the
99
+ # default is for it to be synchronised using an internal +Mutex+
100
+ # instance
101
+ def initialize services, **options
102
+
103
+ @tss_sym = self.to_s.to_sym
104
+ @services = services.map { |svc| MultiplexingLogService_Internals_::ServiceManagementInfo.new svc }
105
+ @options = options.dup
106
+ @mode = options[:level_cache_mode]
107
+ @unsync_pf = options[:unsync_process_lcm]
108
+
109
+ @process_m = {}
110
+ @mx = Mutex.new unless @unsync_pf
111
+ end
112
+
113
+ private
114
+
115
+ # { svc => { sev => flag } }
116
+ def get_tss_svc_sev_map_
117
+
118
+ sym = @tss_sym
119
+ tc = Thread.current
120
+ m = tc.thread_variable_get sym
121
+
122
+ unless m
123
+
124
+ tc.thread_variable_set sym, (m = {})
125
+ end
126
+
127
+ m
128
+ end
129
+
130
+ def svc_sev_logged_tf_ m, svc, severity
131
+
132
+ m[svc.object_id] ||= {}
133
+
134
+ unless m[svc.object_id].has_key? severity
135
+
136
+ r = svc.severity_logged? severity
137
+
138
+ m[svc.object_id][severity] = r
139
+ else
140
+
141
+ r = m[svc.object_id][severity]
142
+ end
143
+
144
+ r
145
+ end
146
+
147
+ def svc_sev_logged_pf_ m, svc, severity
148
+
149
+ m[svc.object_id] ||= {}
150
+
151
+ unless m[svc.object_id].has_key? severity
152
+
153
+ r = svc.severity_logged? severity
154
+
155
+ m[svc.object_id][severity] = r
156
+ else
157
+
158
+ r = m[svc.object_id][severity]
159
+ end
160
+
161
+ r
162
+ end
163
+
164
+ def sev_logged_pf_ m, severity
165
+
166
+ @services.any? { |smi| svc_sev_logged_pf_ m, smi.service, severity }
167
+ end
168
+ public
169
+
170
+ # Indicates whether the given severity is to be logged by any of the
171
+ # multiplexed log services
172
+ def severity_logged? severity
173
+
174
+ case @mode
175
+ when :process_fixed
176
+
177
+ if @unsync_pf
178
+
179
+ sev_logged_pf_ @process_m, severity
180
+ else
181
+
182
+ @mx.synchronize { sev_logged_pf_ @process_m, severity }
183
+ end
184
+ when :thread_fixed
185
+
186
+ m = get_tss_svc_sev_map_
187
+
188
+ @services.any? do |smi|
189
+
190
+ svc = smi.service
191
+
192
+ svc_sev_logged_tf_ m, svc, severity
193
+ end
194
+ else # :none
195
+
196
+ @services.any? { |smi| smi.service.severity_logged? severity }
197
+ end
198
+ end
199
+
200
+ def log sev, t, pref, msg
201
+
202
+ tss_m = :thread_fixed == @mode ? get_tss_svc_sev_map_ : nil
203
+
204
+ @services.each do |smi|
205
+
206
+ svc = smi.service
207
+
208
+ case @mode
209
+ when :process_fixed
210
+
211
+ if @unsync_pf
212
+
213
+ isl = svc_sev_logged_pf_ @process_m, svc, sev
214
+ else
215
+
216
+ isl = @mx.synchronize { svc_sev_logged_pf_ @process_m, svc, sev }
217
+ end
218
+ when :thread_fixed
219
+
220
+ m = tss_m
221
+
222
+ isl = svc_sev_logged_tf_ m, svc, sev
223
+ else # :none
224
+
225
+ isl = svc.severity_logged? sev
226
+ end
227
+
228
+
229
+ svc.log sev, t, pref, msg if isl
230
+ end
231
+ end
232
+ end
233
+
234
+ end # module Services
235
+ end # module Pantheios
236
+
237
+ # ############################## end of file ############################# #
238
+
239
+