pantheios-ruby 0.22.0 → 0.22.0.1
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.rb +3 -2
- data/lib/pantheios/api.rb +2 -1
- data/lib/pantheios/application_layer.rb +2 -1
- data/lib/pantheios/application_layer/param_name_list.rb +9 -0
- data/lib/pantheios/application_layer/stock_severity_levels.rb +13 -6
- data/lib/pantheios/core.rb +26 -14
- data/lib/pantheios/front_ends/threshold_front_end.rb +18 -5
- data/lib/pantheios/globals.rb +6 -3
- data/lib/pantheios/services/multiplexing_log_service.rb +2 -1
- data/lib/pantheios/services/simple_file_log_service.rb +0 -2
- data/lib/pantheios/util/process_util.rb +3 -3
- data/lib/pantheios/util/reflection_util.rb +1 -0
- data/lib/pantheios/util/thread_util.rb +1 -0
- data/lib/pantheios/util/version_util.rb +1 -0
- data/lib/pantheios/version.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad32385bd72202625243bd53a0bb8016939ccc38
|
4
|
+
data.tar.gz: a96bedc8fa2604cf562ce2daa376ceaf929414c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da221cb043bf8a6639497a913e219328e4c68abc53fc73cd76b1e80b0483a07dbecc11c5a36bb8bb2cccd5cbc5c6407c3fc3161e81a12651c46f2e6b9270aa74
|
7
|
+
data.tar.gz: 31182596ce8e65269a7ac3d64ca510d7430874208de1c81e94fce4db8722f30f52dcc0fabfe9792ee70194ab6ea2d7bea49cd739f68424be74fc5543d9eaa169
|
data/lib/pantheios.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
# +Pantheios::API+, +Pantheios::ApplicationLayer+, and +Pantheios::Util+ (as
|
7
7
|
# well as certain sub modules of +Pantheios::Util+; see +Pantheios::Util+
|
8
8
|
# for details), unless the global symbol
|
9
|
-
# +::Pantheios::Globals.HAS_CASCADED_INCLUDES+ is
|
9
|
+
# +::Pantheios::Globals.HAS_CASCADED_INCLUDES+ is falsey
|
10
10
|
module Pantheios
|
11
11
|
end # module Pantheios
|
12
12
|
|
@@ -19,7 +19,8 @@ require 'pantheios/version'
|
|
19
19
|
|
20
20
|
module Pantheios
|
21
21
|
|
22
|
-
|
22
|
+
# @!visibility private
|
23
|
+
def self.included receiver # :nodoc:
|
23
24
|
|
24
25
|
if ::Pantheios::Globals.HAS_CASCADED_INCLUDES
|
25
26
|
|
data/lib/pantheios/api.rb
CHANGED
@@ -2,9 +2,18 @@
|
|
2
2
|
module Pantheios
|
3
3
|
module ApplicationLayer
|
4
4
|
|
5
|
+
# Type-distinct +::Array+ for use with tracing, as in
|
6
|
+
#
|
7
|
+
# def my_func arg1, arg2, **options
|
8
|
+
#
|
9
|
+
# trace ParamNames [ :arg1, :arg2, :options ], arg1, arg2, options
|
10
|
+
#
|
11
|
+
# end
|
12
|
+
#
|
5
13
|
class ParamNameList < Array
|
6
14
|
end
|
7
15
|
|
16
|
+
# Another name for +ParamNameList+
|
8
17
|
ParamNames = ParamNameList
|
9
18
|
|
10
19
|
end # module ApplicationLayer
|
@@ -56,8 +56,10 @@ module ApplicationLayer
|
|
56
56
|
module StockSeverityLevels
|
57
57
|
|
58
58
|
private
|
59
|
-
|
59
|
+
# @!visibility private
|
60
|
+
module Internal_ # :nodoc: all
|
60
61
|
|
62
|
+
# @!visibility private
|
61
63
|
STOCK_SEVERITY_LEVELS_ = {
|
62
64
|
|
63
65
|
:violation => [ 1, 'Violation', :relative, [ :emergency ] ],
|
@@ -77,7 +79,8 @@ module StockSeverityLevels
|
|
77
79
|
:benchmark => [ 16, 'Benchmark', :separate ],
|
78
80
|
}
|
79
81
|
|
80
|
-
|
82
|
+
# @!visibility private
|
83
|
+
def self.create_level_keys m # :nodoc:
|
81
84
|
|
82
85
|
r = m.keys
|
83
86
|
|
@@ -92,7 +95,8 @@ module StockSeverityLevels
|
|
92
95
|
r.uniq
|
93
96
|
end
|
94
97
|
|
95
|
-
|
98
|
+
# @!visibility private
|
99
|
+
def self.create_level_value_map m # :nodoc:
|
96
100
|
|
97
101
|
r = {}
|
98
102
|
|
@@ -110,7 +114,8 @@ module StockSeverityLevels
|
|
110
114
|
r
|
111
115
|
end
|
112
116
|
|
113
|
-
|
117
|
+
# @!visibility private
|
118
|
+
def self.create_level_string_map m # :nodoc:
|
114
119
|
|
115
120
|
r = {}
|
116
121
|
|
@@ -132,7 +137,8 @@ module StockSeverityLevels
|
|
132
137
|
r
|
133
138
|
end
|
134
139
|
|
135
|
-
|
140
|
+
# @!visibility private
|
141
|
+
def self.create_level_aliases m # :nodoc:
|
136
142
|
|
137
143
|
r = {}
|
138
144
|
|
@@ -150,7 +156,8 @@ module StockSeverityLevels
|
|
150
156
|
r
|
151
157
|
end
|
152
158
|
|
153
|
-
|
159
|
+
# @!visibility private
|
160
|
+
def self.create_level_relative_map m # :nodoc:
|
154
161
|
|
155
162
|
r = {}
|
156
163
|
|
data/lib/pantheios/core.rb
CHANGED
@@ -61,7 +61,8 @@ require 'pantheios/util/thread_util'
|
|
61
61
|
module Pantheios
|
62
62
|
module Core
|
63
63
|
|
64
|
-
|
64
|
+
# @!visibility private
|
65
|
+
module Constants_ # :nodoc: all
|
65
66
|
|
66
67
|
REQUIRED_SERVICE_METHODS = %w{ severity_logged? log }.map { |name| name.to_sym }
|
67
68
|
REQUIRED_FRONTEND_METHODS = %w{ severity_logged? }.map { |name| name.to_sym }
|
@@ -69,9 +70,11 @@ module Core
|
|
69
70
|
|
70
71
|
end # module Constants_
|
71
72
|
|
72
|
-
|
73
|
+
# @!visibility private
|
74
|
+
module Internals_ # :nodoc: all
|
73
75
|
|
74
|
-
|
76
|
+
# @!visibility private
|
77
|
+
class DefaultDiscriminator # :nodoc:
|
75
78
|
|
76
79
|
def severity_logged? severity
|
77
80
|
|
@@ -88,8 +91,8 @@ module Core
|
|
88
91
|
end
|
89
92
|
end
|
90
93
|
|
91
|
-
#
|
92
|
-
class State
|
94
|
+
# @!visibility private
|
95
|
+
class State # :nodoc:
|
93
96
|
|
94
97
|
def initialize default_fe, **options
|
95
98
|
|
@@ -200,13 +203,14 @@ module Core
|
|
200
203
|
end # class State
|
201
204
|
end # module Internals_
|
202
205
|
|
203
|
-
|
206
|
+
# @!visibility private
|
207
|
+
def self.included receiver # :nodoc:
|
204
208
|
|
205
209
|
abort "Attempt to include #{self} into #{receiver}. This is not allowed"
|
206
210
|
end
|
207
211
|
|
208
|
-
#
|
209
|
-
def self.core_init
|
212
|
+
# @!visibility private
|
213
|
+
def self.core_init # :nodoc:
|
210
214
|
|
211
215
|
# process-name
|
212
216
|
|
@@ -277,8 +281,8 @@ module Core
|
|
277
281
|
self.set_default_service
|
278
282
|
end
|
279
283
|
|
280
|
-
#
|
281
|
-
def self.set_default_service **options
|
284
|
+
# @!visibility private
|
285
|
+
def self.set_default_service **options # :nodoc:
|
282
286
|
|
283
287
|
# determine which log service to initialise as the default
|
284
288
|
|
@@ -463,7 +467,9 @@ module Core
|
|
463
467
|
|
464
468
|
|
465
469
|
# Internal implementation method, not to be called by application code
|
466
|
-
|
470
|
+
#
|
471
|
+
# @!visibility private
|
472
|
+
def self.get_block_value_ &block # :nodoc:
|
467
473
|
|
468
474
|
case block.arity
|
469
475
|
when 0
|
@@ -487,7 +493,9 @@ module Core
|
|
487
493
|
end
|
488
494
|
|
489
495
|
# Internal implementation method, not to be called by application code
|
490
|
-
|
496
|
+
#
|
497
|
+
# @!visibility private
|
498
|
+
def self.log_v_impl prefix_provider, severity, argv, &block # :nodoc:
|
491
499
|
|
492
500
|
argv << get_block_value_(&block) if block_given?
|
493
501
|
|
@@ -495,7 +503,9 @@ module Core
|
|
495
503
|
end
|
496
504
|
|
497
505
|
# Internal implementation method, not to be called by application code
|
498
|
-
|
506
|
+
#
|
507
|
+
# @!visibility private
|
508
|
+
def self.trace_v_impl prefix_provider, call_depth, param_list, severity, argv, &block # :nodoc:
|
499
509
|
|
500
510
|
unless param_list
|
501
511
|
|
@@ -592,7 +602,9 @@ module Core
|
|
592
602
|
end
|
593
603
|
|
594
604
|
# Internal implementation method, not to be called by application code
|
595
|
-
|
605
|
+
#
|
606
|
+
# @!visibility private
|
607
|
+
def self.log_raw prefix_provider, severity, message # :nodoc:
|
596
608
|
|
597
609
|
now = Time.now
|
598
610
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
# class
|
7
7
|
#
|
8
8
|
# Created: 3rd June 2020
|
9
|
-
# Updated:
|
9
|
+
# Updated: 4th June 2020
|
10
10
|
#
|
11
11
|
# Home: http://github.com/synesissoftware/Pantheios-Ruby
|
12
12
|
#
|
@@ -60,8 +60,6 @@ module FrontEnds
|
|
60
60
|
# the instance method +severity_logged?(severity : Object)+
|
61
61
|
class ThresholdFrontEnd
|
62
62
|
|
63
|
-
include ::Pantheios::ApplicationLayer
|
64
|
-
|
65
63
|
# Initialises the instance
|
66
64
|
#
|
67
65
|
# === Signature
|
@@ -75,6 +73,10 @@ class ThresholdFrontEnd
|
|
75
73
|
# +severity_logged?+. May be +nil+, in which case
|
76
74
|
# +::Pantheios::ApplicationLayer::StockSeverityLevels::STOCK_SEVERITY_LEVEL_VALUES+
|
77
75
|
# is used
|
76
|
+
#
|
77
|
+
# * *Exceptions:*
|
78
|
+
# - +::TypeError+ raised if a value given for +:value_lookup_map+ is
|
79
|
+
# not a ::hash
|
78
80
|
def initialize(threshold_severity, **options)
|
79
81
|
|
80
82
|
m = options[:value_lookup_map]
|
@@ -87,13 +89,24 @@ class ThresholdFrontEnd
|
|
87
89
|
@relativity_lookup_map = ::Hash.new(:relative)
|
88
90
|
else
|
89
91
|
|
90
|
-
@value_lookup_map = StockSeverityLevels::STOCK_SEVERITY_LEVEL_VALUES
|
91
|
-
@relativity_lookup_map = StockSeverityLevels::STOCK_SEVERITY_LEVELS_RELATIVE
|
92
|
+
@value_lookup_map = ::Pantheios::ApplicationLayer::StockSeverityLevels::STOCK_SEVERITY_LEVEL_VALUES
|
93
|
+
@relativity_lookup_map = ::Pantheios::ApplicationLayer::StockSeverityLevels::STOCK_SEVERITY_LEVELS_RELATIVE
|
92
94
|
end
|
93
95
|
|
94
96
|
self.threshold = threshold_severity
|
95
97
|
end
|
96
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
|
97
110
|
def severity_logged? severity
|
98
111
|
|
99
112
|
case severity
|
data/lib/pantheios/globals.rb
CHANGED
@@ -89,7 +89,8 @@ module Pantheios
|
|
89
89
|
#
|
90
90
|
module Globals
|
91
91
|
|
92
|
-
|
92
|
+
# @!visibility private
|
93
|
+
module Internals_ # :nodoc: all
|
93
94
|
|
94
95
|
BOOLEAN_CLASSES = [ ::FalseClass, ::TrueClass ]
|
95
96
|
TRUTHY_CLASSES = BOOLEAN_CLASSES + [ ::NilClass ]
|
@@ -97,7 +98,8 @@ module Globals
|
|
97
98
|
PROCESS_NAME_CLASSES = [ ::Symbol, ::String ]
|
98
99
|
end
|
99
100
|
|
100
|
-
|
101
|
+
# @!visibility private
|
102
|
+
module Helpers_ # :nodoc: all
|
101
103
|
|
102
104
|
def self.cattr receiver, name, types, initial_value, **options
|
103
105
|
|
@@ -146,7 +148,8 @@ module Globals
|
|
146
148
|
|
147
149
|
Helpers_.cattr self, 'SYNCHRONISED_SEVERITY_LOGGED', nil, true, boolean: true
|
148
150
|
|
149
|
-
|
151
|
+
# @!visibility private
|
152
|
+
def self.included receiver # :nodoc:
|
150
153
|
|
151
154
|
abort "Attempt to include #{self} into #{receiver}. This is not allowed"
|
152
155
|
end
|
@@ -60,7 +60,8 @@ module Services
|
|
60
60
|
# +log(severity : Object, t : Time, prefix : String|Array, msg : String)+
|
61
61
|
class MultiplexingLogService
|
62
62
|
|
63
|
-
|
63
|
+
# @!visibility private
|
64
|
+
module MultiplexingLogService_Internals_ # :nodoc: all
|
64
65
|
|
65
66
|
class ServiceManagementInfo
|
66
67
|
|
@@ -95,8 +95,6 @@ class SimpleFileLogService
|
|
95
95
|
# - +:roll_depth+:: [ ::Integer ] The depth of the size-based log
|
96
96
|
# rolling. Overrides the second element in an array specified for
|
97
97
|
# +:roll_size+
|
98
|
-
|
99
|
-
|
100
98
|
def initialize log_file_or_path, **options
|
101
99
|
|
102
100
|
roll_period = options[:roll_period]
|
@@ -2,13 +2,13 @@
|
|
2
2
|
module Pantheios
|
3
3
|
module Util
|
4
4
|
|
5
|
+
# process utilities
|
5
6
|
module ProcessUtil
|
6
7
|
|
7
8
|
#
|
8
9
|
# * *Options:*
|
9
|
-
# - +:style+:: (:script, :script_basename, :script_dirname,
|
10
|
-
#
|
11
|
-
# name. If none specified, :script_stem is assumed
|
10
|
+
# - +:style+:: (:script, :script_basename, :script_dirname, :script_realpath, :script_stem) directs
|
11
|
+
# the inference of the process name. If none specified, :script_stem is assumed
|
12
12
|
def self.derive_process_name dollar0 = nil, **options
|
13
13
|
|
14
14
|
dollar0 ||= $0
|
data/lib/pantheios/version.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# Purpose: Version for Pantheios.Ruby library
|
6
6
|
#
|
7
7
|
# Created: 2nd April 2011
|
8
|
-
# Updated:
|
8
|
+
# Updated: 4th June 2020
|
9
9
|
#
|
10
10
|
# Home: http://github.com/synesissoftware/Pantheios-Ruby
|
11
11
|
#
|
@@ -51,7 +51,7 @@
|
|
51
51
|
module Pantheios
|
52
52
|
|
53
53
|
# Current version of the Pantheios.Ruby library
|
54
|
-
VERSION = '0.22.0'
|
54
|
+
VERSION = '0.22.0.1'
|
55
55
|
|
56
56
|
private
|
57
57
|
VERSION_PARTS_ = VERSION.split(/[.]/).collect { |n| n.to_i } # :nodoc:
|