pantheios-ruby 0.21.0 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: beccaa832a0515a050313c91e674a3804ffe4ac5
4
- data.tar.gz: 2d1e8e82b8f7999578c9898afc94730e86e165d2
3
+ metadata.gz: 554c2a9920c4d3459aac5f8a222cc862547f397d
4
+ data.tar.gz: 8edd3f22884716113a84f5291092d25f4be684bb
5
5
  SHA512:
6
- metadata.gz: 06cfa816a8c31242ea15e6673064c136ccf7b1457f8ed399c165426c2515879c3f3d465aae57f302c3880bcee8b6ef7101e95c93f0526a5b0c9c6eeb521453c1
7
- data.tar.gz: 3887176f2effa59a70304a4c8b5c8da013bf122f9d8882042955767c700b747ceea39d859d0351430fecc08ec32fabfc73f09513cf0d50c3367e22cbe58ef188
6
+ metadata.gz: bf9014bf59fbc49c97509b72fa4f6acbc5b96582ee078598c9f98c83c9a2c691220cf19665da1173859e187b806ff5639192ebe6e409d672e9e4a3d75b95bc7b
7
+ data.tar.gz: 9ce3d10428dd953ba201eec61a32bc4172d341fa9e0bb8332df2685fa902595429f1be41c692bc34c21780962be452e9b0a8d66e35125b2df8eb9dee2ee6df9b
@@ -0,0 +1,37 @@
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
+ require 'pantheios/services/coloured_console_log_service'
9
+
10
+ # globals
11
+
12
+ Pantheios::Globals.INITIAL_SERVICE_CLASSES = [ Pantheios::Services::ColouredConsoleLogService ]
13
+ Pantheios::Globals.MAIN_THREAD_NAME = [ Thread.current, 'main' ]
14
+ Pantheios::Globals.PROCESS_NAME = :script_stem
15
+
16
+ # requires (1)
17
+
18
+ require 'pantheios'
19
+
20
+ # includes
21
+
22
+ include ::Pantheios
23
+
24
+ # constants
25
+
26
+ LEVELS = %i{ violation alert critical failure warning notice informational debug0 debug1 debug2 debug3 debug4 debug5 benchmark }
27
+
28
+ # main
29
+
30
+ LEVELS.each do |level|
31
+
32
+ log(level, "logging level #{level}")
33
+ end
34
+
35
+ # ############################## end of file ############################# #
36
+
37
+
@@ -5,9 +5,11 @@ $:.unshift File.join(File.dirname(__FILE__), *([ '..' ] * 1), 'lib')
5
5
  # requires (0)
6
6
 
7
7
  require 'pantheios/globals'
8
+ require 'pantheios/services/simple_console_log_service'
8
9
 
9
10
  # globals
10
11
 
12
+ Pantheios::Globals.INITIAL_SERVICE_CLASSES = [ Pantheios::Services::SimpleConsoleLogService ]
11
13
  Pantheios::Globals.MAIN_THREAD_NAME = [ Thread.current, 'main' ]
12
14
  Pantheios::Globals.PROCESS_NAME = :script_stem
13
15
 
@@ -21,7 +23,7 @@ include ::Pantheios
21
23
 
22
24
  # constants
23
25
 
24
- LEVELS = %i{ violation alert critical failure warning notice informational debug0 debug1 debug2 debug3 debug4 }
26
+ LEVELS = %i{ violation alert critical failure warning notice informational debug0 debug1 debug2 debug3 debug4 debug5 benchmark }
25
27
 
26
28
  # main
27
29
 
@@ -5,13 +5,13 @@
5
5
  # Purpose: The Pantheios.Ruby API (::Pantheios::API)
6
6
  #
7
7
  # Created: 2nd April 2011
8
- # Updated: 22nd January 2018
8
+ # Updated: 4th 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) 2011-2018, Matthew Wilson and Synesis Software
14
+ # Copyright (c) 2011-2019, 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
@@ -47,7 +47,6 @@
47
47
  =begin
48
48
  =end
49
49
 
50
-
51
50
  require 'pantheios/application_layer/param_name_list'
52
51
  require 'pantheios/application_layer/stock_severity_levels'
53
52
  require 'pantheios/util/version_util'
@@ -74,6 +73,8 @@ module Pantheios
74
73
  # - severity_string severity
75
74
  # - thread_id
76
75
  # - timestamp t
76
+ # - prefix_parts
77
+ # - prefix
77
78
  module API
78
79
 
79
80
  # Logs an arbitrary set of parameters at the given severity level
@@ -217,7 +218,13 @@ module API
217
218
  ::Pantheios::Core.timestamp t, nil
218
219
  end
219
220
 
220
- def prefix t, severity
221
+ # Assembles the prefix according to +prefix_elements+ into an array of
222
+ # parts
223
+ #
224
+ # * *Parameters:*
225
+ # - +t+ [ Date, Time, DateTime ] The timestamp of the log entry
226
+ # - +severity+ The severity
227
+ def prefix_parts t, severity
221
228
 
222
229
  prefix_elements.map do |el|
223
230
 
@@ -245,9 +252,18 @@ module API
245
252
 
246
253
  nil
247
254
  end
248
- end.join(', ') # TODO: need to do more intelligent joining
255
+ end
249
256
  end
250
257
 
258
+ # Assembles the +prefix_parts+ into a string
259
+ #
260
+ # * *Parameters:*
261
+ # - +t+ [ Date, Time, DateTime ] The timestamp of the log entry
262
+ # - +severity+ The severity
263
+ def prefix t, severity
264
+
265
+ prefix_parts(t, severity).join(', ')
266
+ end
251
267
 
252
268
  def self.included receiver
253
269
 
@@ -7,7 +7,7 @@
7
7
  # namespace module
8
8
  #
9
9
  # Created: 2nd April 2011
10
- # Updated: 3rd June 2020
10
+ # Updated: 4th June 2020
11
11
  #
12
12
  # Home: http://github.com/synesissoftware/Pantheios-Ruby
13
13
  #
@@ -96,12 +96,12 @@ module StockSeverityLevels
96
96
 
97
97
  r = {}
98
98
 
99
- m.each do |s, ar|
99
+ m.each do |sev, ar|
100
100
 
101
- warn 'invalid start-up' unless ::Symbol === s
101
+ warn 'invalid start-up' unless ::Symbol === sev
102
102
  warn 'invalid start-up' unless ::Array === ar
103
103
 
104
- ([s] + (ar[3] || [])).each do |al|
104
+ ([sev] + (ar[3] || [])).each do |al|
105
105
 
106
106
  r[al] = ar[0]
107
107
  end
@@ -114,14 +114,18 @@ module StockSeverityLevels
114
114
 
115
115
  r = {}
116
116
 
117
- m.each do |s, ar|
117
+ m.each do |sev, ar|
118
118
 
119
- warn 'invalid start-up' unless ::Symbol === s
119
+ warn 'invalid start-up' unless ::Symbol === sev
120
120
  warn 'invalid start-up' unless ::Array === ar
121
121
 
122
- ([s] + (ar[3] || [])).each do |al|
122
+ ([sev] + (ar[3] || [])).each do |al|
123
123
 
124
- r[al] = ar[1]
124
+ s = ar[1]
125
+
126
+ s.define_singleton_method(:severity) { sev }
127
+
128
+ r[al] = s
125
129
  end
126
130
  end
127
131
 
@@ -132,14 +136,14 @@ module StockSeverityLevels
132
136
 
133
137
  r = {}
134
138
 
135
- m.each do |s, ar|
139
+ m.each do |sev, ar|
136
140
 
137
- warn 'invalid start-up' unless ::Symbol === s
141
+ warn 'invalid start-up' unless ::Symbol === sev
138
142
  warn 'invalid start-up' unless ::Array === ar
139
143
 
140
- ([s] + (ar[3] || [])).each do |al|
144
+ ([sev] + (ar[3] || [])).each do |al|
141
145
 
142
- r[al] = s
146
+ r[al] = sev
143
147
  end
144
148
  end
145
149
 
@@ -150,9 +154,9 @@ module StockSeverityLevels
150
154
 
151
155
  r = {}
152
156
 
153
- m.each do |s, ar|
157
+ m.each do |sev, ar|
154
158
 
155
- warn 'invalid start-up' unless ::Symbol === s
159
+ warn 'invalid start-up' unless ::Symbol === sev
156
160
  warn 'invalid start-up' unless ::Array === ar
157
161
 
158
162
  relativity = ar[2]
@@ -160,7 +164,7 @@ module StockSeverityLevels
160
164
  case relativity
161
165
  when :relative
162
166
 
163
- ([s] + (ar[3] || [])).each do |al|
167
+ ([sev] + (ar[3] || [])).each do |al|
164
168
 
165
169
  r[al] = relativity
166
170
  end
@@ -5,12 +5,13 @@
5
5
  # Purpose: The Pantheios.Ruby core (::Pantheios::Core)
6
6
  #
7
7
  # Created: 2nd April 2011
8
- # Updated: 5th September 2018
8
+ # Updated: 4th 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-2018, Matthew Wilson and Synesis Software
15
16
  # All rights reserved.
16
17
  #
@@ -122,7 +123,7 @@ module Core
122
123
  raise ::TypeError, "back-end instance (#{fe.class}) does not respond to all the required messages ([ #{Constants_::REQUIRED_BACKEND_METHODS.join(', ')} ])" unless be && Constants_::REQUIRED_BACKEND_METHODS.all? { |m| be.respond_to? m }
123
124
 
124
125
  r = nil
125
- srp = svc.respond_to?(:requires_prefix?) ? svc.requires_prefix? : true
126
+ srp = be.respond_to?(:requires_prefix?) ? be.requires_prefix? : true
126
127
 
127
128
  @mx_service.synchronize do
128
129
 
@@ -196,7 +197,7 @@ module Core
196
197
  attr_reader :front_end
197
198
  attr_reader :back_end
198
199
  def requires_prefix?; @requires_prefix; end
199
- end
200
+ end # class State
200
201
  end # module Internals_
201
202
 
202
203
  def self.included receiver
@@ -595,7 +596,24 @@ module Core
595
596
 
596
597
  now = Time.now
597
598
 
598
- prf = @@state.requires_prefix? ? '[' + prefix_provider.prefix(now, severity) + ']: ' : nil
599
+ srp = @@state.requires_prefix?
600
+
601
+ case srp
602
+ when false
603
+
604
+ prf = nil
605
+ when true
606
+
607
+ prf = '[' + prefix_provider.prefix(now, severity) + ']: '
608
+ when :parts
609
+
610
+ prf = prefix_provider.prefix_parts(now, severity)
611
+ else
612
+
613
+ warn "invalid value '#{srp}' returned by #requires_prefix? of the Pantheios Core's state's service (which is of type #{@@state.service.class}"
614
+
615
+ prf = nil
616
+ end
599
617
 
600
618
  @@state.back_end.log severity, now, prf, message
601
619
  end
@@ -0,0 +1,204 @@
1
+
2
+ # ######################################################################## #
3
+ # File: lib/pantheios/services/coloured_console_log_service.rb
4
+ #
5
+ # Purpose: Definition of the
6
+ # ::Pantheios::Services::ColouredConsoleLogService class
7
+ #
8
+ # Created: 19th June 2019
9
+ # Updated: 4th June 2020
10
+ #
11
+ # Home: http://github.com/synesissoftware/Pantheios-Ruby
12
+ #
13
+ # Author: Matthew Wilson
14
+ #
15
+ # Copyright (c) 2019-2020, Matthew Wilson and Synesis Information Systems
16
+ # Copyright (c) 2019, Matthew Wilson and Synesis Software
17
+ # All rights reserved.
18
+ #
19
+ # Redistribution and use in source and binary forms, with or without
20
+ # modification, are permitted provided that the following conditions are
21
+ # met:
22
+ #
23
+ # * Redistributions of source code must retain the above copyright
24
+ # notice, this list of conditions and the following disclaimer.
25
+ #
26
+ # * Redistributions in binary form must reproduce the above copyright
27
+ # notice, this list of conditions and the following disclaimer in the
28
+ # documentation and/or other materials provided with the distribution.
29
+ #
30
+ # * Neither the names of the copyright holder nor the names of its
31
+ # contributors may be used to endorse or promote products derived from
32
+ # this software without specific prior written permission.
33
+ #
34
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
35
+ # IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
36
+ # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
37
+ # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
38
+ # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
39
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
40
+ # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
41
+ # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
42
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
43
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
44
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
45
+ #
46
+ # ######################################################################## #
47
+
48
+
49
+ require 'pantheios/services/common/console'
50
+
51
+ =begin
52
+ =end
53
+
54
+ module Pantheios
55
+ module Services
56
+
57
+ # A class that fulfils the Pantheios *LogService* protocol that allows all
58
+ # severities and logs to the console (via +$stdout+ and +$stderr+)
59
+ #
60
+ # NOTE: The *LogService* protocol is implemented by a class that provides
61
+ # the instance methods +severity_logged?(severity : Object) : boolean+ and
62
+ # +log(severity : Object, t : Time, prefix : String|Array, msg : String)+
63
+ class ColouredConsoleLogService
64
+
65
+ module Constants
66
+
67
+ include ::Pantheios::Services::Common::Console::AnsiEscapeSequences
68
+ end # module Constants
69
+
70
+ def self.requires_prefix?
71
+
72
+ return @requires_prefix unless @requires_prefix.nil?
73
+
74
+ @requires_prefix = ::Pantheios::Services::Common::Console::Internal_::SHOULD_COLOURIZE_ ? :parts : false
75
+ end
76
+
77
+ def requires_prefix?
78
+
79
+ self.class.requires_prefix?
80
+ end
81
+
82
+ def severity_logged? severity
83
+
84
+ true
85
+ end
86
+
87
+ def log sev, t, pref, msg
88
+
89
+ stm = infer_stream sev
90
+
91
+ if requires_prefix?
92
+
93
+ pref = pref.map do |part|
94
+
95
+ bg = Constants::Background
96
+ fg = Constants::Foreground
97
+
98
+ if part.respond_to?(:severity)
99
+
100
+ part = fg.bold part
101
+
102
+ case sev
103
+ when :violation
104
+
105
+ part = bg.red part
106
+ #part = fg.bright_magenta part
107
+ part = fg.bright_yellow part
108
+ part = fg.blinking part
109
+ when :alert
110
+
111
+ part = bg.red part
112
+ part = fg.bright_cyan part
113
+ part = fg.blinking part
114
+ when :critical
115
+
116
+ part = bg.red part
117
+ part = fg.white part
118
+ when :failure
119
+
120
+ part = bg.yellow part
121
+ part = fg.red part
122
+ when :warning
123
+
124
+ part = bg.yellow part
125
+ part = fg.blue part
126
+ when :notice
127
+
128
+ part = bg.dark_grey part
129
+ part = fg.white part
130
+ when :informational
131
+
132
+ part = bg.dark_grey part
133
+ part = fg.light_grey part
134
+ when :debug0
135
+
136
+ part = bg.blue part
137
+ part = fg.light_grey part
138
+ when :debug1
139
+
140
+ part = bg.blue part
141
+ part = fg.light_grey part
142
+ when :debug2
143
+
144
+ part = bg.blue part
145
+ part = fg.light_grey part
146
+ when :debug3
147
+
148
+ part = bg.blue part
149
+ part = fg.light_grey part
150
+ when :debug4
151
+
152
+ part = bg.blue part
153
+ part = fg.light_grey part
154
+ when :debug5
155
+
156
+ part = bg.blue part
157
+ part = fg.light_grey part
158
+ when :trace
159
+
160
+ part = bg.blue part
161
+ part = fg.light_grey part
162
+ when :benchmark
163
+
164
+ part = bg.black part
165
+ part = fg.light_grey part
166
+ else
167
+
168
+ ;
169
+ end
170
+ else
171
+
172
+ part = fg.dark_grey part
173
+ end
174
+
175
+ part
176
+ end.join(', ')
177
+
178
+ pref = '[' + pref + ']: '
179
+
180
+ #pref = pref.map { |pp| pp.severity? ? map_sev_(sev) : sev }.join(
181
+ end
182
+
183
+ stm.puts "#{pref}#{msg}"
184
+ end
185
+
186
+ # Overrideable method that determines which stream to write, based on a
187
+ # severity. This implementation always returns +$stderr+
188
+ #
189
+ # Overrides must return an object that supports the +puts(String)+
190
+ # method
191
+ def infer_stream sev
192
+
193
+ $stderr
194
+ end
195
+
196
+ private
197
+ end # class ColouredConsoleLogService
198
+
199
+ end # module Services
200
+ end # module Pantheios
201
+
202
+ # ############################## end of file ############################# #
203
+
204
+
@@ -0,0 +1,92 @@
1
+
2
+ module Pantheios
3
+ module Services
4
+ module Common
5
+
6
+ module Console
7
+
8
+ module Internal_
9
+
10
+ STDERR_ISATTY_ = $stderr.isatty
11
+ OS_IS_UNIX_ = %w{
12
+
13
+ darwin
14
+ freebsd
15
+ linux
16
+ mingw32
17
+ solaris
18
+ sunos
19
+ }.any? { |os| RUBY_PLATFORM =~ /#{os.downcase}/ }
20
+ SHOULD_COLOURIZE_ = STDERR_ISATTY_ && OS_IS_UNIX_
21
+
22
+ module ColourInitialiser
23
+
24
+ def self.extended other
25
+
26
+ other::COLOURS.each do |name, value|
27
+
28
+ other.const_set(name.to_s.upcase, value)
29
+
30
+ if SHOULD_COLOURIZE_
31
+
32
+ other.define_singleton_method(name) { |s| "\x1B[#{value}m#{s}\x1B[0m" }
33
+ else
34
+
35
+ other.define_singleton_method(name) { |s| s }
36
+ end
37
+ end
38
+ end
39
+ end # module ColourInitialiser
40
+ end # module Internal_
41
+
42
+ module AnsiEscapeSequences
43
+
44
+ module Foreground
45
+
46
+ COLOURS = {
47
+
48
+ blinking: 5,
49
+ bold: 1,
50
+ default: 39,
51
+
52
+ black: 30,
53
+ red: 31,
54
+ green: 32,
55
+ yellow: 33,
56
+ blue: 34,
57
+ magenta: 35,
58
+ cyan: 36,
59
+ light_grey: 37,
60
+
61
+ dark_grey: 90,
62
+ bright_red: 91,
63
+ bright_green: 92,
64
+ bright_yellow: 93,
65
+ bright_blue: 94,
66
+ bright_magenta: 95,
67
+ bright_cyan: 96,
68
+ white: 97,
69
+ }
70
+
71
+ extend Internal_::ColourInitialiser
72
+ end # module Foreground
73
+
74
+ module Background
75
+
76
+ COLOURS = Hash[Foreground::COLOURS.reject { |k, v| [ :blinking, :bold, :default ].include? k }.map { |k, v| [ k, 10 + v ] }]
77
+
78
+ extend Internal_::ColourInitialiser
79
+ end # module Background
80
+
81
+ module Special
82
+
83
+ # TODO
84
+
85
+ end # module Special
86
+ end # end AnsiEscapeSequences
87
+
88
+ end # module Console
89
+ end # module Common
90
+ end # module Services
91
+ end # module Pantheios
92
+
@@ -6,12 +6,13 @@
6
6
  # ::Pantheios::Services::MultiplexingLogService class
7
7
  #
8
8
  # Created: 14th June 2015
9
- # Updated: 8th February 2018
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 MultiplexingLogService
61
62
 
62
63
  module MultiplexingLogService_Internals_
@@ -167,6 +168,43 @@ class MultiplexingLogService
167
168
  end
168
169
  public
169
170
 
171
+ # Indicates whether any of the services require a prefix and, if so,
172
+ # what it may require
173
+ #
174
+ # === Return
175
+ # (+false+, +true+, +:parts+) An indicator what the most needy of the
176
+ # multiplexed services requires
177
+ def requires_prefix?
178
+
179
+ return @requires_prefix unless @requires_prefix.nil?
180
+
181
+ requires_prefix = false
182
+
183
+ @services.each do |svc|
184
+
185
+ if svc.respond_to? :requires_prefix?
186
+
187
+ case rp = svc.requires_prefix?
188
+ when nil, false
189
+
190
+ ;
191
+ when true
192
+
193
+ requires_prefix ||= true
194
+ when :parts
195
+
196
+ requires_prefix = rp
197
+ break
198
+ else
199
+
200
+ warn "unrecognised return from requires_prefix? for service #{svc}: #{rp} (#{rp.class})"
201
+ end
202
+ end
203
+ end
204
+
205
+ @requires_prefix = requires_prefix
206
+ end
207
+
170
208
  # Indicates whether the given severity is to be logged by any of the
171
209
  # multiplexed log services
172
210
  def severity_logged? severity
@@ -6,12 +6,13 @@
6
6
  # class
7
7
  #
8
8
  # Created: 14th June 2015
9
- # Updated: 8th February 2018
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: 12th March 2018
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 February 2018
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: 23rd January 2018
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
@@ -51,7 +51,7 @@
51
51
  module Pantheios
52
52
 
53
53
  # Current version of the Pantheios.Ruby library
54
- VERSION = '0.21.0'
54
+ VERSION = '0.22.0'
55
55
 
56
56
  private
57
57
  VERSION_PARTS_ = VERSION.split(/[.]/).collect { |n| n.to_i } # :nodoc:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pantheios-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.21.0
4
+ version: 0.22.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Wilson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-03 00:00:00.000000000 Z
11
+ date: 2020-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xqsr3
@@ -34,6 +34,7 @@ extra_rdoc_files: []
34
34
  files:
35
35
  - LICENSE
36
36
  - README.md
37
+ - examples/coloured_console_log_service.rb
37
38
  - examples/multiple_modules.md
38
39
  - examples/multiple_modules.rb
39
40
  - examples/simple_logging.md
@@ -47,6 +48,8 @@ files:
47
48
  - lib/pantheios/front_ends/threshold_front_end.rb
48
49
  - lib/pantheios/globals.rb
49
50
  - lib/pantheios/services.rb
51
+ - lib/pantheios/services/coloured_console_log_service.rb
52
+ - lib/pantheios/services/common/console.rb
50
53
  - lib/pantheios/services/multiplexing_log_service.rb
51
54
  - lib/pantheios/services/null_log_service.rb
52
55
  - lib/pantheios/services/simple_console_log_service.rb