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.
Files changed (61) hide show
  1. checksums.yaml +5 -5
  2. data/AUTHORS.md +21 -0
  3. data/CHANGES.md +337 -0
  4. data/CONTRIBUTING.md +36 -0
  5. data/EXAMPLES.md +11 -0
  6. data/FAQ.md +28 -0
  7. data/INSTALL.md +43 -0
  8. data/LICENSE +21 -20
  9. data/NEWS.md +65 -0
  10. data/README.md +134 -2
  11. data/Rakefile +21 -0
  12. data/SECURITY.md +23 -0
  13. data/TODO.md +29 -0
  14. data/examples/coloured_console_log_service.rb +1 -1
  15. data/examples/multiple_modules.md +1 -1
  16. data/examples/multiple_modules.rb +36 -36
  17. data/examples/simple_logging.md +1 -1
  18. data/examples/simple_logging.rb +1 -1
  19. data/examples/threshold_front_end.rb +1 -1
  20. data/lib/pantheios/api.rb +156 -155
  21. data/lib/pantheios/application_layer/param_name_list.rb +1 -0
  22. data/lib/pantheios/application_layer/stock_severity_levels.rb +110 -111
  23. data/lib/pantheios/application_layer.rb +6 -5
  24. data/lib/pantheios/core.rb +416 -415
  25. data/lib/pantheios/front_ends/threshold_front_end.rb +81 -81
  26. data/lib/pantheios/globals.rb +45 -45
  27. data/lib/pantheios/services/coloured_console_log_service.rb +96 -96
  28. data/lib/pantheios/services/common/console.rb +58 -57
  29. data/lib/pantheios/services/multiplexing_log_service.rb +151 -150
  30. data/lib/pantheios/services/null_log_service.rb +11 -11
  31. data/lib/pantheios/services/simple_console_log_service.rb +20 -20
  32. data/lib/pantheios/services/simple_file_log_service.rb +112 -113
  33. data/lib/pantheios/services/standard_log_service_adapter.rb +119 -119
  34. data/lib/pantheios/services.rb +1 -0
  35. data/lib/pantheios/util/process_util.rb +25 -24
  36. data/lib/pantheios/util/reflection_util.rb +14 -13
  37. data/lib/pantheios/util/thread_util.rb +50 -49
  38. data/lib/pantheios/util/version_util.rb +34 -33
  39. data/lib/pantheios/util.rb +1 -0
  40. data/lib/pantheios/version.rb +19 -19
  41. data/lib/pantheios.rb +12 -12
  42. data/test/performance/test_perf_simple_statements.rb +58 -58
  43. data/test/performance/test_perf_trace_variants.rb +43 -57
  44. data/test/scratch/log_rolling_by_period_daily.rb +3 -3
  45. data/test/scratch/log_rolling_by_size_and_depth.rb +3 -3
  46. data/test/scratch/log_using_blocks.rb +12 -12
  47. data/test/scratch/multiplexing_log_service.rb +32 -32
  48. data/test/unit/application_layer/tc_param_name_list.rb +13 -13
  49. data/test/unit/application_layer/tc_stock_severity_levels.rb +102 -102
  50. data/test/unit/core/tc_core_1.rb +24 -24
  51. data/test/unit/front_ends/tc_threshold_front_end.rb +65 -65
  52. data/test/unit/services/tc_multiplexing_log_service.rb +79 -79
  53. data/test/unit/services/tc_null_log_service.rb +42 -42
  54. data/test/unit/services/tc_simple_console_log_service.rb +70 -70
  55. data/test/unit/services/tc_simple_file_log_service.rb +146 -146
  56. data/test/unit/services/tc_standard_log_service_adapter.rb +94 -96
  57. data/test/unit/util/tc_process_util.rb +6 -6
  58. data/test/unit/util/tc_reflection_util.rb +20 -20
  59. data/test/unit/util/tc_thread_util.rb +46 -46
  60. data/test/unit/util/tc_version_util.rb +47 -47
  61. metadata +33 -12
@@ -1,19 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- #############################################################################
4
- # File: test/performance/test_perf_trace_variants.rb
5
- #
6
- # Purpose: COMPLETE_ME
7
- #
8
- # Created: 22nd January 2018
9
- # Updated: 22nd January 2018
10
- #
11
- # Author: Matthew Wilson
12
- #
13
- # Copyright: <<TBD>>
14
- #
15
- #############################################################################
16
-
17
3
  $:.unshift File.join(File.dirname(__FILE__), *(['..'] * 2), 'lib')
18
4
 
19
5
  require 'pantheios/globals'
@@ -32,100 +18,100 @@ T = Time.now
32
18
 
33
19
  def severity_logged? severity
34
20
 
35
- return ::Pantheios::Core.severity_logged? severity
21
+ return ::Pantheios::Core.severity_logged? severity
36
22
  end
37
23
 
38
24
 
39
25
  def blank_trace p0, p1, p2, p3, t
40
26
 
41
- trace
27
+ trace
42
28
  end
43
29
 
44
30
  def anonymous_trace p0, p1, p2, p3, t
45
31
 
46
- trace p0, p1, p2, p3, t
32
+ trace p0, p1, p2, p3, t
47
33
  end
48
34
 
49
35
  def parameter_trace p0, p1, p2, p3, t
50
36
 
51
- trace ParamNames[ :p0, :p1, :p2, :p3, :t ], p0, p1, p2, p3, t
37
+ trace ParamNames[ :p0, :p1, :p2, :p3, :t ], p0, p1, p2, p3, t
52
38
  end
53
39
 
54
40
  def parameter_cond p0, p1, p2, p3, t
55
41
 
56
- trace ParamNames[ :p0, :p1, :p2, :p3, :t ], p0, p1, p2, p3, t if severity_logged? :trace
42
+ trace ParamNames[ :p0, :p1, :p2, :p3, :t ], p0, p1, p2, p3, t if severity_logged? :trace
57
43
  end
58
44
 
59
45
  def names_in_block p0, p1, p2, p3, t
60
46
 
61
- trace(p0, p1, p2, p3, t) { ParamNames[ :p0, :p1, :p2, :p3, :t ] }
47
+ trace(p0, p1, p2, p3, t) { ParamNames[ :p0, :p1, :p2, :p3, :t ] }
62
48
  end
63
49
 
64
50
  def all_in_block p0, p1, p2, p3, t
65
51
 
66
- trace { [ ParamNames[ :p0, :p1, :p2, :p3, :t ], p0, p1, p2, p3, t ] }
52
+ trace { [ ParamNames[ :p0, :p1, :p2, :p3, :t ], p0, p1, p2, p3, t ] }
67
53
  end
68
54
 
69
55
 
70
56
  Benchmark.benchmark(Benchmark::CAPTION, 24, Benchmark::FORMAT, 'total:', 'avg:') do |r|
71
57
 
72
- t_log = r.report('plain log') do
58
+ r.report('plain log') do
73
59
 
74
- for i in (0...N) do
60
+ N.times do
75
61
 
76
- log :abc, 'd', 'ef', 't=', T
77
- end
78
- end
62
+ log :abc, 'd', 'ef', 't=', T
63
+ end
64
+ end
79
65
 
80
- t_blank_trace = r.report('blank_trace') do
66
+ r.report('blank_trace') do
81
67
 
82
- for i in (0...N) do
68
+ N.times do
83
69
 
84
- blank_trace :abc, 'd', 'ef', 't=', T
85
- end
86
- end
70
+ blank_trace :abc, 'd', 'ef', 't=', T
71
+ end
72
+ end
87
73
 
88
- t_anonymous_trace = r.report('anonymous_trace') do
74
+ r.report('anonymous_trace') do
89
75
 
90
- for i in (0...N) do
76
+ N.times do
91
77
 
92
- anonymous_trace :abc, 'd', 'ef', 't=', T
93
- end
94
- end
78
+ anonymous_trace :abc, 'd', 'ef', 't=', T
79
+ end
80
+ end
95
81
 
96
- t_parameter_trace = r.report('parameter_trace') do
82
+ r.report('parameter_trace') do
97
83
 
98
- for i in (0...N) do
84
+ N.times do
99
85
 
100
- parameter_trace :abc, 'd', 'ef', 't=', T
101
- end
102
- end
86
+ parameter_trace :abc, 'd', 'ef', 't=', T
87
+ end
88
+ end
103
89
 
104
- t_parameter_cond = r.report('parameter_cond') do
90
+ r.report('parameter_cond') do
105
91
 
106
- for i in (0...N) do
92
+ N.times do
107
93
 
108
- parameter_cond :abc, 'd', 'ef', 't=', T
109
- end
110
- end
94
+ parameter_cond :abc, 'd', 'ef', 't=', T
95
+ end
96
+ end
111
97
 
112
- t_names_in_block = r.report('names_in_block') do
98
+ r.report('names_in_block') do
113
99
 
114
- for i in (0...N) do
100
+ N.times do
115
101
 
116
- names_in_block :abc, 'd', 'ef', 't=', T
117
- end
118
- end
102
+ names_in_block :abc, 'd', 'ef', 't=', T
103
+ end
104
+ end
119
105
 
120
- t_all_in_block = r.report('all_in_block') do
106
+ r.report('all_in_block') do
121
107
 
122
- for i in (0...N) do
108
+ N.times do
123
109
 
124
- all_in_block :abc, 'd', 'ef', 't=', T
125
- end
126
- end
110
+ all_in_block :abc, 'd', 'ef', 't=', T
111
+ end
112
+ end
127
113
 
128
- # [ at_0 + at_1 + at_2 + bt_0 + bt_1 + bt_2, (at_0 + at_1 + at_2 + bt_0 + bt_1 + bt_2) / 2 ]
114
+ # [ at_0 + at_1 + at_2 + bt_0 + bt_1 + bt_2, (at_0 + at_1 + at_2 + bt_0 + bt_1 + bt_2) / 2 ]
129
115
  end
130
116
 
131
117
 
@@ -6,7 +6,7 @@
6
6
  # Purpose: Tests the log-rolling functionality of SimpleFileLogService
7
7
  #
8
8
  # Created: 4th February 2018
9
- # Updated: 4th February 2018
9
+ # Updated: 28th August 2026
10
10
  #
11
11
  # Author: Matthew Wilson
12
12
  #
@@ -33,9 +33,9 @@ log(:notice) { 'program started' }
33
33
 
34
34
  (0..1000).each do |n|
35
35
 
36
- log :informational, "increment #{n}: '#{'*' * 10 * n}'"
36
+ log :informational, "increment #{n}: '#{'*' * 10 * n}'"
37
37
 
38
- sleep 100
38
+ sleep 100
39
39
  end
40
40
 
41
41
  at_exit { log :notice, 'program ending ...' }
@@ -6,7 +6,7 @@
6
6
  # Purpose: Tests the log-rolling functionality of SimpleFileLogService
7
7
  #
8
8
  # Created: 4th February 2018
9
- # Updated: 4th February 2018
9
+ # Updated: 28th August 2026
10
10
  #
11
11
  # Author: Matthew Wilson
12
12
  #
@@ -33,9 +33,9 @@ log(:notice) { 'program started' }
33
33
 
34
34
  (0..1000).each do |n|
35
35
 
36
- log :informational, "increment #{n}: '#{'*' * 10 * n}'"
36
+ log :informational, "increment #{n}: '#{'*' * 10 * n}'"
37
37
 
38
- sleep 1
38
+ sleep 1
39
39
  end
40
40
 
41
41
  at_exit { log :notice, 'program ending ...' }
@@ -6,7 +6,7 @@
6
6
  # Purpose: COMPLETE_ME
7
7
  #
8
8
  # Created: 22nd January 2018
9
- # Updated: 5th February 2018
9
+ # Updated: 28th August 2026
10
10
  #
11
11
  # Author: Matthew Wilson
12
12
  #
@@ -32,33 +32,33 @@ log(:notice) { 'program started' }
32
32
 
33
33
  def f param0, param1
34
34
 
35
- trace
35
+ trace
36
36
 
37
- log :trace
37
+ log :trace
38
38
 
39
- trace param0, param1
39
+ trace param0, param1
40
40
 
41
- log :trace, param0, param1
41
+ log :trace, param0, param1
42
42
 
43
- trace ParamNames[ :param0, :param1 ], param0, param1
43
+ trace ParamNames[ :param0, :param1 ], param0, param1
44
44
 
45
- log :trace, ParamNames[ :param0, :param1 ], param0, param1
45
+ log :trace, ParamNames[ :param0, :param1 ], param0, param1
46
46
 
47
- trace { [ ParamNames[ :param0, :param1 ], param0, param1 ] }
47
+ trace { [ ParamNames[ :param0, :param1 ], param0, param1 ] }
48
48
  end
49
49
 
50
50
  def g param0, param1
51
51
 
52
- trace(param0, param1) { [ ParamNames[ :param0, :param1 ]] }
52
+ trace(param0, param1) { [ ParamNames[ :param0, :param1 ]] }
53
53
 
54
- f param0, param1
54
+ f param0, param1
55
55
  end
56
56
 
57
57
  def h param0, param1, param2
58
58
 
59
- trace(param0, param1, param2) { ParamNames[ :param0, :param1, :param2 ] }
59
+ trace(param0, param1, param2) { ParamNames[ :param0, :param1, :param2 ] }
60
60
 
61
- g param0, param1
61
+ g param0, param1
62
62
  end
63
63
 
64
64
 
@@ -6,7 +6,7 @@
6
6
  # Purpose: COMPLETE_ME
7
7
  #
8
8
  # Created: 7th February 2018
9
- # Updated: 7th February 2018
9
+ # Updated: 28th August 2026
10
10
  #
11
11
  # Author: Matthew Wilson
12
12
  #
@@ -20,60 +20,60 @@ require 'pantheios'
20
20
  require 'pantheios/application_layer/stock_severity_levels'
21
21
  require 'pantheios/services'
22
22
 
23
- $num_BLS_sls = 0
24
- $num_ELS_sls = 0
23
+ $num_BLS_sls = 0
24
+ $num_ELS_sls = 0
25
25
 
26
26
  class BenchmarkLogService
27
27
 
28
- def severity_logged? severity
28
+ def severity_logged? severity
29
29
 
30
- $num_BLS_sls += 1
30
+ $num_BLS_sls += 1
31
31
 
32
- (0..100).each { |n| n ** n }
32
+ (0..100).each { |n| n ** n }
33
33
 
34
- :benchmark == severity.to_s.to_sym
35
- end
34
+ :benchmark == severity.to_s.to_sym
35
+ end
36
36
 
37
- def log sev, t, pref, msg
37
+ def log sev, t, pref, msg
38
38
 
39
- puts "BENCHMARK: #{pref}#{msg}\n"
40
- end
39
+ puts "BENCHMARK: #{pref}#{msg}\n"
40
+ end
41
41
  end
42
42
 
43
43
  class EventLogService
44
44
 
45
- def severity_logged? severity
45
+ def severity_logged? severity
46
46
 
47
- $num_ELS_sls += 1
47
+ $num_ELS_sls += 1
48
48
 
49
- case severity.to_s.to_sym
50
- when :notice, :warning, :failure, :critical, :alert, :violation
49
+ case severity.to_s.to_sym
50
+ when :notice, :warning, :failure, :critical, :alert, :violation
51
51
 
52
- true
53
- when :warn, :error, :emergency
52
+ true
53
+ when :warn, :error, :emergency
54
54
 
55
- true
56
- else
55
+ true
56
+ else
57
57
 
58
- false
59
- end
60
- end
58
+ false
59
+ end
60
+ end
61
61
 
62
- def log sev, t, pref, msg
62
+ def log sev, t, pref, msg
63
63
 
64
- puts "EVENTLOG: #{pref}#{msg}\n"
65
- end
64
+ puts "EVENTLOG: #{pref}#{msg}\n"
65
+ end
66
66
  end
67
67
 
68
- scls = Pantheios::Services::SimpleConsoleLogService.new
68
+ scls = Pantheios::Services::SimpleConsoleLogService.new
69
69
 
70
70
  def scls.severity_logged? severity; ![ :benchmark, :trace, :violation ].include? severity; end
71
71
 
72
- services = [
72
+ services = [
73
73
 
74
- BenchmarkLogService.new,
75
- EventLogService.new,
76
- scls,
74
+ BenchmarkLogService.new,
75
+ EventLogService.new,
76
+ scls,
77
77
  ]
78
78
 
79
79
  lcm = :none
@@ -86,7 +86,7 @@ Pantheios::Core.set_service Pantheios::Services::MultiplexingLogService.new(serv
86
86
 
87
87
  include Pantheios
88
88
 
89
- t_b = Time.now
89
+ t_b = Time.now
90
90
 
91
91
  log :benchmark, 'statement at benchmark'
92
92
  (0..100000).each { log :trace, 'statement at trace' }
@@ -103,7 +103,7 @@ log :critical, 'statement at critical'
103
103
  log :alert, 'statement at alert'
104
104
  log :violation, 'statement at violation'
105
105
 
106
- t_a = Time.now
106
+ t_a = Time.now
107
107
 
108
108
  $stderr.puts "mode= :#{lcm}; t=#{t_a - t_b}; #BLS=#{$num_BLS_sls}; #ELS=#{$num_ELS_sls}"
109
109
 
@@ -10,26 +10,26 @@ require 'test/unit'
10
10
 
11
11
  class Test_ParamNameList_type_characteristics < Test::Unit::TestCase
12
12
 
13
- include ::Pantheios::ApplicationLayer
13
+ include ::Pantheios::ApplicationLayer
14
14
 
15
- def test_ParamNameList_type_exists
15
+ def test_ParamNameList_type_exists
16
16
 
17
- assert defined? ParamNameList
18
- end
17
+ assert defined? ParamNameList
18
+ end
19
19
 
20
- def test_ParamNames_type_exists
20
+ def test_ParamNames_type_exists
21
21
 
22
- assert defined? ParamNames
23
- end
22
+ assert defined? ParamNames
23
+ end
24
24
 
25
- def test_ParamNameList_type_is_a_class
25
+ def test_ParamNameList_type_is_a_class
26
26
 
27
- assert ParamNameList.is_a? ::Class
28
- end
27
+ assert ParamNameList.is_a? ::Class
28
+ end
29
29
 
30
- def test_ParamNames_type_is_a_class
30
+ def test_ParamNames_type_is_a_class
31
31
 
32
- assert ParamNames.is_a? ::Class
33
- end
32
+ assert ParamNames.is_a? ::Class
33
+ end
34
34
  end
35
35