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/front_ends/threshold_front_end.rb
|
|
4
4
|
#
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
# class
|
|
7
7
|
#
|
|
8
8
|
# Created: 3rd June 2020
|
|
9
|
-
# Updated:
|
|
9
|
+
# Updated: 28th August 2026
|
|
10
10
|
#
|
|
11
|
-
# Home:
|
|
11
|
+
# Home: https://github.com/synesissoftware/Pantheios.Ruby
|
|
12
12
|
#
|
|
13
13
|
# Author: Matthew Wilson
|
|
14
14
|
#
|
|
15
|
-
# Copyright (c) 2020, Matthew Wilson and Synesis Information Systems
|
|
15
|
+
# Copyright (c) 2020-2026, Matthew Wilson and Synesis Information Systems
|
|
16
16
|
# All rights reserved.
|
|
17
17
|
#
|
|
18
18
|
# Redistribution and use in source and binary forms, with or without
|
|
@@ -60,83 +60,83 @@ module FrontEnds
|
|
|
60
60
|
# the instance method +severity_logged?(severity : Object)+
|
|
61
61
|
class ThresholdFrontEnd
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
63
|
+
# Initialises the instance
|
|
64
|
+
#
|
|
65
|
+
# === Signature
|
|
66
|
+
#
|
|
67
|
+
# * *Parameters:*
|
|
68
|
+
# - +threshold_severity+ [ ::Symbol ] The threshold severity
|
|
69
|
+
#
|
|
70
|
+
# * *Options:*
|
|
71
|
+
# - +value_lookup_map+ [ ::Hash ] A map that is used to lookup
|
|
72
|
+
# +severity+ values (that are not +::Integer+) in
|
|
73
|
+
# +severity_logged?+. May be +nil+, in which case
|
|
74
|
+
# +::Pantheios::ApplicationLayer::StockSeverityLevels::STOCK_SEVERITY_LEVEL_VALUES+
|
|
75
|
+
# is used
|
|
76
|
+
#
|
|
77
|
+
# * *Exceptions:*
|
|
78
|
+
# - +::TypeError+ raised if a value given for +:value_lookup_map+ is
|
|
79
|
+
# not a ::hash
|
|
80
|
+
def initialize(threshold_severity, **options)
|
|
81
|
+
|
|
82
|
+
m = options[:value_lookup_map]
|
|
83
|
+
|
|
84
|
+
raise TypeError, "value given for :value_lookup_map must be a #{::Hash}" if m && !m.respond_to?(:to_hash)
|
|
85
|
+
|
|
86
|
+
if m
|
|
87
|
+
|
|
88
|
+
@value_lookup_map = m
|
|
89
|
+
@relativity_lookup_map = ::Hash.new(:relative)
|
|
90
|
+
else
|
|
91
|
+
|
|
92
|
+
@value_lookup_map = ::Pantheios::ApplicationLayer::StockSeverityLevels::STOCK_SEVERITY_LEVEL_VALUES
|
|
93
|
+
@relativity_lookup_map = ::Pantheios::ApplicationLayer::StockSeverityLevels::STOCK_SEVERITY_LEVELS_RELATIVE
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
self.threshold = threshold_severity
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# Determines whether a given severity is logged
|
|
100
|
+
#
|
|
101
|
+
# === Signature
|
|
102
|
+
#
|
|
103
|
+
# * *Parameters:*
|
|
104
|
+
# - +severity+:: The severity level, which should be a known log
|
|
105
|
+
# severity symbol or an integral equivalent
|
|
106
|
+
#
|
|
107
|
+
# * *Returns:*
|
|
108
|
+
# a +truey+ value if the severity should be logged; a +falsey+ value
|
|
109
|
+
# otherwise
|
|
110
|
+
def severity_logged? severity
|
|
111
|
+
|
|
112
|
+
case severity
|
|
113
|
+
when ::Integer
|
|
114
|
+
|
|
115
|
+
v = severity
|
|
116
|
+
else
|
|
117
|
+
|
|
118
|
+
v = @value_lookup_map[severity] or warn "unknown severity level '#{severity}' (#{severity.class})"
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
return true if v.nil?
|
|
122
|
+
|
|
123
|
+
v <= @threshold_v
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# assigns the threshold
|
|
127
|
+
#
|
|
128
|
+
# * *Parameters:*
|
|
129
|
+
# - +threshold_severity+ [ ::Symbol ] The threshold severity
|
|
130
|
+
def threshold=(threshold_severity)
|
|
131
|
+
|
|
132
|
+
raise TypeError, "threshold_severity must be a #{::Symbol}" unless ::Symbol === threshold_severity
|
|
133
|
+
|
|
134
|
+
@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})"
|
|
135
|
+
@threshold = threshold_severity
|
|
136
|
+
|
|
137
|
+
nil
|
|
138
|
+
end
|
|
139
|
+
attr_reader :threshold
|
|
140
140
|
|
|
141
141
|
end # class ThresholdFrontEnd
|
|
142
142
|
|
data/lib/pantheios/globals.rb
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
2
|
# ######################################################################## #
|
|
3
3
|
# File: lib/pantheios/globals.rb
|
|
4
4
|
#
|
|
5
5
|
# Purpose: The Pantheios.Ruby "globals" (::Pantheios::Globals)
|
|
6
6
|
#
|
|
7
7
|
# Created: 24th December 2017
|
|
8
|
-
# Updated:
|
|
8
|
+
# Updated: 28th August 2026
|
|
9
9
|
#
|
|
10
|
-
# Home:
|
|
10
|
+
# Home: https://github.com/synesissoftware/Pantheios.Ruby
|
|
11
11
|
#
|
|
12
12
|
# Author: Matthew Wilson
|
|
13
13
|
#
|
|
14
|
-
# Copyright (c) 2019-
|
|
15
|
-
# Copyright (c) 2017-
|
|
14
|
+
# Copyright (c) 2019-2026, Matthew Wilson and Synesis Information Systems
|
|
15
|
+
# Copyright (c) 2017-2019, Matthew Wilson and Synesis Software
|
|
16
16
|
# All rights reserved.
|
|
17
17
|
#
|
|
18
18
|
# Redistribution and use in source and binary forms, with or without
|
|
@@ -89,70 +89,70 @@ module Pantheios
|
|
|
89
89
|
#
|
|
90
90
|
module Globals
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
# @!visibility private
|
|
93
|
+
module Internals_ # :nodoc: all
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
BOOLEAN_CLASSES = [ ::FalseClass, ::TrueClass ]
|
|
96
|
+
TRUTHY_CLASSES = BOOLEAN_CLASSES + [ ::NilClass ]
|
|
97
97
|
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
PROCESS_NAME_CLASSES = [ ::Symbol, ::String ]
|
|
99
|
+
end
|
|
100
100
|
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
# @!visibility private
|
|
102
|
+
module Helpers_ # :nodoc: all
|
|
103
103
|
|
|
104
|
-
|
|
104
|
+
def self.cattr receiver, name, types, initial_value, **options
|
|
105
105
|
|
|
106
|
-
|
|
106
|
+
if options[:boolean] && types.nil?
|
|
107
107
|
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
types = Internals_::TRUTHY_CLASSES
|
|
109
|
+
end
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
types = nil if !types.nil? && types.empty?
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
receiver.class_eval do
|
|
114
114
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
field_name = '@' + name
|
|
116
|
+
get_name = name
|
|
117
|
+
get_name += '?' if options[:boolean]
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
instance_variable_set field_name, initial_value
|
|
120
120
|
|
|
121
|
-
|
|
121
|
+
define_singleton_method(get_name) do
|
|
122
122
|
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
instance_variable_get field_name
|
|
124
|
+
end
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
define_singleton_method(name + '=') do |v|
|
|
127
127
|
|
|
128
|
-
|
|
128
|
+
if types
|
|
129
129
|
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
warn "Assigning to #{__method__} with argument of invalid type - #{v.class} given; one of #{types.join(', ')} required" unless types.any? { |c| c === v }
|
|
131
|
+
end
|
|
132
132
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
133
|
+
instance_variable_set field_name, v
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
138
|
|
|
139
|
-
|
|
139
|
+
Helpers_.cattr self, 'HAS_CASCADED_INCLUDES', Internals_::BOOLEAN_CLASSES, true
|
|
140
140
|
|
|
141
|
-
|
|
141
|
+
Helpers_.cattr self, 'INITIAL_SERVICE_INSTANCES', nil, nil
|
|
142
142
|
|
|
143
|
-
|
|
143
|
+
Helpers_.cattr self, 'INITIAL_SERVICE_CLASSES', nil, nil
|
|
144
144
|
|
|
145
|
-
|
|
145
|
+
Helpers_.cattr self, 'MAIN_THREAD_NAME', [ ::Array, ::String ], nil
|
|
146
146
|
|
|
147
|
-
|
|
147
|
+
Helpers_.cattr self, 'PROCESS_NAME', Internals_::PROCESS_NAME_CLASSES, nil
|
|
148
148
|
|
|
149
|
-
|
|
149
|
+
Helpers_.cattr self, 'SYNCHRONISED_SEVERITY_LOGGED', nil, true, boolean: true
|
|
150
150
|
|
|
151
|
-
|
|
152
|
-
|
|
151
|
+
# @!visibility private
|
|
152
|
+
def self.included receiver # :nodoc:
|
|
153
153
|
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
abort "Attempt to include #{self} into #{receiver}. This is not allowed"
|
|
155
|
+
end
|
|
156
156
|
|
|
157
157
|
end # module Globals
|
|
158
158
|
end # module Pantheios
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
2
|
# ######################################################################## #
|
|
3
3
|
# File: lib/pantheios/services/coloured_console_log_service.rb
|
|
4
4
|
#
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
# ::Pantheios::Services::ColouredConsoleLogService class
|
|
7
7
|
#
|
|
8
8
|
# Created: 19th June 2019
|
|
9
|
-
# Updated:
|
|
9
|
+
# Updated: 28th August 2026
|
|
10
10
|
#
|
|
11
|
-
# Home:
|
|
11
|
+
# Home: https://github.com/synesissoftware/Pantheios.Ruby
|
|
12
12
|
#
|
|
13
13
|
# Author: Matthew Wilson
|
|
14
14
|
#
|
|
15
|
-
# Copyright (c) 2019-
|
|
15
|
+
# Copyright (c) 2019-2026, Matthew Wilson and Synesis Information Systems
|
|
16
16
|
# Copyright (c) 2019, Matthew Wilson and Synesis Software
|
|
17
17
|
# All rights reserved.
|
|
18
18
|
#
|
|
@@ -62,138 +62,138 @@ module Services
|
|
|
62
62
|
# +log(severity : Object, t : Time, prefix : String|Array, msg : String)+
|
|
63
63
|
class ColouredConsoleLogService
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
module Constants
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
include ::Pantheios::Services::Common::Console::AnsiEscapeSequences
|
|
68
|
+
end # module Constants
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
def self.requires_prefix?
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
return @requires_prefix unless @requires_prefix.nil?
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
@requires_prefix = ::Pantheios::Services::Common::Console::Internal_::SHOULD_COLOURIZE_ ? :parts : false
|
|
75
|
+
end
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
def requires_prefix?
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
self.class.requires_prefix?
|
|
80
|
+
end
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
def severity_logged? severity
|
|
83
83
|
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
true
|
|
85
|
+
end
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
def log sev, t, pref, msg
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
stm = infer_stream sev
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
if requires_prefix?
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
pref = pref.map do |part|
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
bg = Constants::Background
|
|
96
|
+
fg = Constants::Foreground
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
if part.respond_to?(:severity)
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
part = fg.bold part
|
|
101
101
|
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
case sev
|
|
103
|
+
when :violation
|
|
104
104
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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
110
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
111
|
+
part = bg.red part
|
|
112
|
+
part = fg.bright_cyan part
|
|
113
|
+
part = fg.blinking part
|
|
114
|
+
when :critical
|
|
115
115
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
part = bg.red part
|
|
117
|
+
part = fg.white part
|
|
118
|
+
when :failure
|
|
119
119
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
part = bg.yellow part
|
|
121
|
+
part = fg.red part
|
|
122
|
+
when :warning
|
|
123
123
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
part = bg.yellow part
|
|
125
|
+
part = fg.blue part
|
|
126
|
+
when :notice
|
|
127
127
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
part = bg.dark_grey part
|
|
129
|
+
part = fg.white part
|
|
130
|
+
when :informational
|
|
131
131
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
132
|
+
part = bg.dark_grey part
|
|
133
|
+
part = fg.light_grey part
|
|
134
|
+
when :debug0
|
|
135
135
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
part = bg.blue part
|
|
137
|
+
part = fg.light_grey part
|
|
138
|
+
when :debug1
|
|
139
139
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
140
|
+
part = bg.blue part
|
|
141
|
+
part = fg.light_grey part
|
|
142
|
+
when :debug2
|
|
143
143
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
144
|
+
part = bg.blue part
|
|
145
|
+
part = fg.light_grey part
|
|
146
|
+
when :debug3
|
|
147
147
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
148
|
+
part = bg.blue part
|
|
149
|
+
part = fg.light_grey part
|
|
150
|
+
when :debug4
|
|
151
151
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
152
|
+
part = bg.blue part
|
|
153
|
+
part = fg.light_grey part
|
|
154
|
+
when :debug5
|
|
155
155
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
156
|
+
part = bg.blue part
|
|
157
|
+
part = fg.light_grey part
|
|
158
|
+
when :trace
|
|
159
159
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
160
|
+
part = bg.blue part
|
|
161
|
+
part = fg.light_grey part
|
|
162
|
+
when :benchmark
|
|
163
163
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
164
|
+
part = bg.black part
|
|
165
|
+
part = fg.light_grey part
|
|
166
|
+
else
|
|
167
167
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
168
|
+
;
|
|
169
|
+
end
|
|
170
|
+
else
|
|
171
171
|
|
|
172
|
-
|
|
173
|
-
|
|
172
|
+
part = fg.dark_grey part
|
|
173
|
+
end
|
|
174
174
|
|
|
175
|
-
|
|
176
|
-
|
|
175
|
+
part
|
|
176
|
+
end.join(', ')
|
|
177
177
|
|
|
178
|
-
|
|
178
|
+
pref = '[' + pref + ']: '
|
|
179
179
|
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
#pref = pref.map { |pp| pp.severity? ? map_sev_(sev) : sev }.join(
|
|
181
|
+
end
|
|
182
182
|
|
|
183
|
-
|
|
184
|
-
|
|
183
|
+
stm.puts "#{pref}#{msg}"
|
|
184
|
+
end
|
|
185
185
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
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
192
|
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
$stderr
|
|
194
|
+
end
|
|
195
195
|
|
|
196
|
-
|
|
196
|
+
private
|
|
197
197
|
end # class ColouredConsoleLogService
|
|
198
198
|
|
|
199
199
|
end # module Services
|