pantheios-ruby 0.18.2 → 0.19.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/lib/pantheios/services.rb +3 -0
- data/lib/pantheios/services/multiplexing_log_service.rb +239 -0
- data/lib/pantheios/services/null_log_service.rb +2 -2
- data/lib/pantheios/version.rb +3 -3
- data/test/scratch/multiplexing_log_service.rb +109 -0
- data/test/unit/services/tc_multiplexing_log_service.rb +144 -0
- metadata +23 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c08cdda0f4237044c0b2681d2b1a5cf47ff2315f
|
4
|
+
data.tar.gz: b06b7ac4f43eead0c66d1253b72198ae1b63b28a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8650e0cad32dcb92b16e677da6e7a09def7302c52465460fe431890827d074cd11d009ba22d06f85a2f0de9b5003f902882085ffc206233dd47dda0de9e65e69
|
7
|
+
data.tar.gz: 3ccbdfd84bf0b5ba7ada60754bd40e3a4361637da3f0c07e8ee225fd4fe1125c26f8bffcddbd8bcab58bd1ed37a97b1c02fd99a68a3e8eb9e2e5090e1ed5e940
|
@@ -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
|
+
|
@@ -1,12 +1,12 @@
|
|
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: 8th February 2018
|
10
10
|
#
|
11
11
|
# Home: http://github.com/synesissoftware/Pantheios-Ruby
|
12
12
|
#
|
data/lib/pantheios/version.rb
CHANGED
@@ -5,13 +5,13 @@
|
|
5
5
|
# Purpose: Version for Pantheios.Ruby library
|
6
6
|
#
|
7
7
|
# Created: 2nd April 2011
|
8
|
-
# Updated:
|
8
|
+
# Updated: 8th February 2018
|
9
9
|
#
|
10
10
|
# Home: http://github.com/synesissoftware/Pantheios-Ruby
|
11
11
|
#
|
12
12
|
# Author: Matthew Wilson
|
13
13
|
#
|
14
|
-
# Copyright (c) 2011-
|
14
|
+
# Copyright (c) 2011-2018, Matthew Wilson and Synesis Software
|
15
15
|
# All rights reserved.
|
16
16
|
#
|
17
17
|
# Redistribution and use in source and binary forms, with or without
|
@@ -50,7 +50,7 @@
|
|
50
50
|
module Pantheios
|
51
51
|
|
52
52
|
# Current version of the Pantheios.Ruby library
|
53
|
-
VERSION = '0.
|
53
|
+
VERSION = '0.19.2'
|
54
54
|
|
55
55
|
private
|
56
56
|
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
|
+
|
@@ -0,0 +1,144 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# test/unit/services/tc_multiplexing_log_service.rb
|
4
|
+
|
5
|
+
$:.unshift File.join(File.dirname(__FILE__), '../../..', 'lib')
|
6
|
+
|
7
|
+
require 'pantheios/services/multiplexing_log_service'
|
8
|
+
|
9
|
+
require 'pantheios/api'
|
10
|
+
require 'pantheios/application_layer/stock_severity_levels'
|
11
|
+
|
12
|
+
require 'xqsr3/extensions/test/unit'
|
13
|
+
|
14
|
+
require 'test/unit'
|
15
|
+
|
16
|
+
require 'stringio'
|
17
|
+
|
18
|
+
class Test_MultiplexingLogservice < Test::Unit::TestCase
|
19
|
+
|
20
|
+
include ::Pantheios::API
|
21
|
+
include ::Pantheios::Services
|
22
|
+
|
23
|
+
class ProgrammableLogService
|
24
|
+
|
25
|
+
def initialize name, severities
|
26
|
+
|
27
|
+
@name = name
|
28
|
+
@severities = severities
|
29
|
+
@items = []
|
30
|
+
end
|
31
|
+
|
32
|
+
attr_reader :name
|
33
|
+
attr_reader :items
|
34
|
+
|
35
|
+
def severity_logged? severity
|
36
|
+
|
37
|
+
@severities.include? severity
|
38
|
+
end
|
39
|
+
|
40
|
+
def log sev, t, pref, msg
|
41
|
+
|
42
|
+
@items << [ sev, t, pref, msg ]
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def log_multiple_statements svc
|
47
|
+
|
48
|
+
previous, _ = Pantheios::Core.set_service svc
|
49
|
+
|
50
|
+
begin
|
51
|
+
|
52
|
+
severities = Pantheios::ApplicationLayer::StockSeverityLevels::STOCK_SEVERITY_LEVELS_PRIME
|
53
|
+
|
54
|
+
severities.each do |sev|
|
55
|
+
|
56
|
+
log sev, "a(n) #{sev} statement"
|
57
|
+
end
|
58
|
+
ensure
|
59
|
+
|
60
|
+
Pantheios::Core.set_service previous
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
|
65
|
+
def test_MultiplexingLogService_type_exists
|
66
|
+
|
67
|
+
assert defined? MultiplexingLogService
|
68
|
+
end
|
69
|
+
|
70
|
+
if defined?(MultiplexingLogService)
|
71
|
+
|
72
|
+
def test_MultiplexingLogService_type_is_a_class
|
73
|
+
|
74
|
+
assert_kind_of(::Class, MultiplexingLogService)
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_MultiplexingLogService_type_has_expected_instance_methods
|
78
|
+
|
79
|
+
assert_type_has_instance_methods MultiplexingLogService, [ :severity_logged?, :log ]
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_multiplex_1
|
83
|
+
|
84
|
+
svc_0 = ProgrammableLogService.new 'svc_0', Pantheios::ApplicationLayer::StockSeverityLevels::STOCK_SEVERITY_LEVELS_PRIME - [ :informational, :notice, :trace ]
|
85
|
+
svc_1 = ProgrammableLogService.new 'svc_1', [ :informational, :notice, :warning, :failure ]
|
86
|
+
svc_2 = ProgrammableLogService.new 'svc_2', [ :informational, :debug0, :debug1, :debug2, :debug3, :debug4 ]
|
87
|
+
|
88
|
+
svc = MultiplexingLogService.new [ svc_0, svc_1, svc_2 ]
|
89
|
+
|
90
|
+
log_multiple_statements svc
|
91
|
+
|
92
|
+
assert_equal 11, svc_0.items.size
|
93
|
+
assert_equal 4, svc_1.items.size
|
94
|
+
assert_equal 6, svc_2.items.size
|
95
|
+
end
|
96
|
+
|
97
|
+
def test_multiplex_2
|
98
|
+
|
99
|
+
svc_0 = ProgrammableLogService.new 'svc_0', Pantheios::ApplicationLayer::StockSeverityLevels::STOCK_SEVERITY_LEVELS_PRIME - [ :informational, :notice, :trace ]
|
100
|
+
svc_1 = ProgrammableLogService.new 'svc_1', [ :informational, :notice, :warning, :failure ]
|
101
|
+
svc_2 = ProgrammableLogService.new 'svc_2', [ :informational, :debug0, :debug1, :debug2, :debug3, :debug4 ]
|
102
|
+
|
103
|
+
svc = MultiplexingLogService.new [ svc_0, svc_1, svc_2 ], level_cache_mode: :none
|
104
|
+
|
105
|
+
log_multiple_statements svc
|
106
|
+
|
107
|
+
assert_equal 11, svc_0.items.size
|
108
|
+
assert_equal 4, svc_1.items.size
|
109
|
+
assert_equal 6, svc_2.items.size
|
110
|
+
end
|
111
|
+
|
112
|
+
def test_multiplex_3
|
113
|
+
|
114
|
+
svc_0 = ProgrammableLogService.new 'svc_0', Pantheios::ApplicationLayer::StockSeverityLevels::STOCK_SEVERITY_LEVELS_PRIME - [ :informational, :notice, :trace ]
|
115
|
+
svc_1 = ProgrammableLogService.new 'svc_1', [ :informational, :notice, :warning, :failure ]
|
116
|
+
svc_2 = ProgrammableLogService.new 'svc_2', [ :informational, :debug0, :debug1, :debug2, :debug3, :debug4 ]
|
117
|
+
|
118
|
+
svc = MultiplexingLogService.new [ svc_0, svc_1, svc_2 ], level_cache_mode: :process_fixed
|
119
|
+
|
120
|
+
log_multiple_statements svc
|
121
|
+
|
122
|
+
assert_equal 11, svc_0.items.size
|
123
|
+
assert_equal 4, svc_1.items.size
|
124
|
+
assert_equal 6, svc_2.items.size
|
125
|
+
end
|
126
|
+
|
127
|
+
def test_multiplex_4
|
128
|
+
|
129
|
+
svc_0 = ProgrammableLogService.new 'svc_0', Pantheios::ApplicationLayer::StockSeverityLevels::STOCK_SEVERITY_LEVELS_PRIME - [ :informational, :notice, :trace ]
|
130
|
+
svc_1 = ProgrammableLogService.new 'svc_1', [ :informational, :notice, :warning, :failure ]
|
131
|
+
svc_2 = ProgrammableLogService.new 'svc_2', [ :informational, :debug0, :debug1, :debug2, :debug3, :debug4 ]
|
132
|
+
|
133
|
+
svc = MultiplexingLogService.new [ svc_0, svc_1, svc_2 ], level_cache_mode: :thread_fixed
|
134
|
+
|
135
|
+
log_multiple_statements svc
|
136
|
+
|
137
|
+
assert_equal 11, svc_0.items.size
|
138
|
+
assert_equal 4, svc_1.items.size
|
139
|
+
assert_equal 6, svc_2.items.size
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
|
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pantheios-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.19.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Wilson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xqsr3
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.21.1
|
20
|
+
- - <
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '1.0'
|
20
23
|
type: :development
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- -
|
27
|
+
- - '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.21.1
|
30
|
+
- - <
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0
|
32
|
+
version: '1.0'
|
27
33
|
description: |
|
28
34
|
A Ruby version of the popular C++ (and .NET) logging API library
|
29
35
|
email: matthew@synesis.com.au
|
@@ -38,6 +44,8 @@ files:
|
|
38
44
|
- lib/pantheios/application_layer/stock_severity_levels.rb
|
39
45
|
- lib/pantheios/core.rb
|
40
46
|
- lib/pantheios/globals.rb
|
47
|
+
- lib/pantheios/services.rb
|
48
|
+
- lib/pantheios/services/multiplexing_log_service.rb
|
41
49
|
- lib/pantheios/services/null_log_service.rb
|
42
50
|
- lib/pantheios/services/simple_console_log_service.rb
|
43
51
|
- lib/pantheios/services/simple_file_log_service.rb
|
@@ -54,11 +62,13 @@ files:
|
|
54
62
|
- test/scratch/log_rolling_by_period_daily.rb
|
55
63
|
- test/scratch/log_rolling_by_size_and_depth.rb
|
56
64
|
- test/scratch/log_using_blocks.rb
|
65
|
+
- test/scratch/multiplexing_log_service.rb
|
57
66
|
- test/unit/application_layer/tc_param_name_list.rb
|
58
67
|
- test/unit/application_layer/tc_stock_severity_levels.rb
|
59
68
|
- test/unit/application_layer/ts_all.rb
|
60
69
|
- test/unit/core/tc_core_1.rb
|
61
70
|
- test/unit/core/ts_all.rb
|
71
|
+
- test/unit/services/tc_multiplexing_log_service.rb
|
62
72
|
- test/unit/services/tc_null_log_service.rb
|
63
73
|
- test/unit/services/tc_simple_console_log_service.rb
|
64
74
|
- test/unit/services/tc_simple_file_log_service.rb
|
@@ -70,9 +80,9 @@ files:
|
|
70
80
|
- test/unit/util/tc_thread_util.rb
|
71
81
|
- test/unit/util/tc_version_util.rb
|
72
82
|
- test/unit/util/ts_all.rb
|
73
|
-
homepage: http://
|
83
|
+
homepage: http://www.pantheios.org/
|
74
84
|
licenses:
|
75
|
-
- BSD
|
85
|
+
- Modified BSD
|
76
86
|
metadata: {}
|
77
87
|
post_install_message:
|
78
88
|
rdoc_options: []
|
@@ -80,18 +90,19 @@ require_paths:
|
|
80
90
|
- lib
|
81
91
|
required_ruby_version: !ruby/object:Gem::Requirement
|
82
92
|
requirements:
|
83
|
-
- -
|
93
|
+
- - '>='
|
84
94
|
- !ruby/object:Gem::Version
|
85
|
-
version: '
|
95
|
+
version: '0'
|
86
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
97
|
requirements:
|
88
|
-
- -
|
98
|
+
- - '>='
|
89
99
|
- !ruby/object:Gem::Version
|
90
100
|
version: '0'
|
91
101
|
requirements: []
|
92
102
|
rubyforge_project:
|
93
|
-
rubygems_version: 2.2
|
103
|
+
rubygems_version: 2.4.2
|
94
104
|
signing_key:
|
95
105
|
specification_version: 4
|
96
106
|
summary: Pantheios.Ruby
|
97
107
|
test_files: []
|
108
|
+
has_rdoc:
|