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
data/README.md
CHANGED
|
@@ -1,5 +1,137 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Pantheios.Ruby <!-- omit in toc -->
|
|
2
|
+
|
|
2
3
|
Pantheios, for Ruby
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+

|
|
6
|
+
[](https://opensource.org/licenses/BSD-3-Clause)
|
|
7
|
+
[](https://badge.fury.io/rb/pantheios-ruby)
|
|
8
|
+
[](https://github.com/synesissoftware/Pantheios.Ruby/commits/master)
|
|
9
|
+
[](https://github.com/synesissoftware/Pantheios.Ruby/actions/workflows/ruby.yml)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## Table of Contents <!-- omit in toc -->
|
|
13
|
+
|
|
14
|
+
- [Introduction](#introduction)
|
|
15
|
+
- [Installation](#installation)
|
|
16
|
+
- [Components](#components)
|
|
17
|
+
- [Examples](#examples)
|
|
18
|
+
- [Project Information](#project-information)
|
|
19
|
+
- [Where to get help](#where-to-get-help)
|
|
20
|
+
- [Contribution guidelines](#contribution-guidelines)
|
|
21
|
+
- [Dependencies](#dependencies)
|
|
22
|
+
- [Efferent (fan-out)](#efferent-fan-out)
|
|
23
|
+
- [Runtime Dependencies (aka "Normal Dependencies")](#runtime-dependencies-aka-normal-dependencies)
|
|
24
|
+
- [Development Dependencies](#development-dependencies)
|
|
25
|
+
- [Afferent (fan-in)](#afferent-fan-in)
|
|
26
|
+
- [Runtime dependents](#runtime-dependents)
|
|
27
|
+
- [Development dependents](#development-dependents)
|
|
28
|
+
- [Related projects](#related-projects)
|
|
29
|
+
- [License](#license)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
## Introduction
|
|
33
|
+
|
|
34
|
+
**Pantheios** is a diagnostic logging API library, originally implemented for C/C++ and later for .NET. **Pantheios.Ruby** is the **Ruby** implementation.
|
|
35
|
+
|
|
36
|
+
It provides a layered logging model: application-facing severity levels and API helpers, optional front-ends (for example threshold filtering), and pluggable back-end log services (console, coloured console, file, null, multiplexing, and adapters).
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
## Installation
|
|
40
|
+
|
|
41
|
+
Install via **gem** as in:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
gem install pantheios-ruby
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
or add it to your `Gemfile`.
|
|
48
|
+
|
|
49
|
+
**Pantheios.Ruby** requires Ruby **2.0+**.
|
|
50
|
+
|
|
51
|
+
> **NOTE**: On **Ruby 4+**, also install [**logger**](https://rubygems.org/gems/logger) (`gem install logger`, or `gem 'logger'` in your Gemfile). See [Runtime Dependencies](#runtime-dependencies-aka-normal-dependencies).
|
|
52
|
+
|
|
53
|
+
Use via **require**, as in:
|
|
54
|
+
|
|
55
|
+
```Ruby
|
|
56
|
+
require 'pantheios'
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
## Components
|
|
61
|
+
|
|
62
|
+
* **Pantheios::API** — primary logging API surface;
|
|
63
|
+
* **Pantheios::ApplicationLayer** — stock severity levels and related application helpers;
|
|
64
|
+
* **Pantheios::Core** — core registration and back-end wiring;
|
|
65
|
+
* **Pantheios::FrontEnds** — front-ends such as **ThresholdFrontEnd**;
|
|
66
|
+
* **Pantheios::Services** — back-end log services (console, coloured console, file, null, multiplexing, adapters);
|
|
67
|
+
* **Pantheios::Util** — process, reflection, thread, and version utilities;
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
## Examples
|
|
71
|
+
|
|
72
|
+
Examples are provided in the ```examples``` directory, along with a markdown description where present. A detailed list TOC of them is provided in [EXAMPLES.md](./EXAMPLES.md).
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
## Project Information
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
### Where to get help
|
|
79
|
+
|
|
80
|
+
[GitHub Page](https://github.com/synesissoftware/Pantheios.Ruby "GitHub Page")
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
### Contribution guidelines
|
|
84
|
+
|
|
85
|
+
Defect reports, feature requests, and pull requests are welcome on https://github.com/synesissoftware/Pantheios.Ruby.
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
### Dependencies
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
#### Efferent (fan-out)
|
|
92
|
+
|
|
93
|
+
Libraries upon which **Pantheios.Ruby** depends:
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
##### Runtime Dependencies (aka "Normal Dependencies")
|
|
97
|
+
|
|
98
|
+
* \<none> declared in **pantheios-ruby.gemspec**;
|
|
99
|
+
|
|
100
|
+
> **NOTE**: On **Ruby 4+**, **logger** is required at runtime (`lib/pantheios/services/simple_file_log_service.rb`, `lib/pantheios/services/standard_log_service_adapter.rb`) but is no longer a default gem and is not listed in **pantheios-ruby.gemspec** (so older Rubies in the `[2.0, 4)` range still resolve). Install it explicitly, e.g. `gem install logger`, or add `gem 'logger'` to your Gemfile. This repository’s **Gemfile** pulls it in when `RUBY_VERSION >= '4'`.
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
##### Development Dependencies
|
|
104
|
+
|
|
105
|
+
* [**rake**](https://rubygems.org/gems/rake);
|
|
106
|
+
* [**test-unit**](https://rubygems.org/gems/test-unit);
|
|
107
|
+
* [**xqsr3**](https://github.com/synesissoftware/xqsr3);
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
#### Afferent (fan-in)
|
|
111
|
+
|
|
112
|
+
Projects that depend on **Pantheios.Ruby**:
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
##### Runtime dependents
|
|
116
|
+
|
|
117
|
+
* \<none>;
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
##### Development dependents
|
|
121
|
+
|
|
122
|
+
* \<none>;
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
### Related projects
|
|
126
|
+
|
|
127
|
+
* [**Pantheios**](https://github.com/synesissoftware/Pantheios/) (**C**/**C++**);
|
|
128
|
+
* [**Pantheios.NET**](https://github.com/synesissoftware/Pantheios.NET/);
|
|
129
|
+
* [**Pantheios.Rust**](https://github.com/synesissoftware/Pantheios.Rust/);
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
### License
|
|
133
|
+
|
|
134
|
+
**Pantheios.Ruby** is released under the 3-clause BSD license. See [LICENSE](./LICENSE) for details.
|
|
135
|
+
|
|
5
136
|
|
|
137
|
+
<!-- ########################### end of file ########################### -->
|
data/Rakefile
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Rakefile for Pantheios.Ruby
|
|
4
|
+
|
|
5
|
+
require 'rake/testtask'
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Rake::TestTask.new do |tt|
|
|
9
|
+
|
|
10
|
+
tt.libs << 'lib'
|
|
11
|
+
tt.libs << 'test'
|
|
12
|
+
tt.name = 'test'
|
|
13
|
+
tt.test_files = FileList['test/**/tc_*.rb']
|
|
14
|
+
tt.verbose = true
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
task :default => :test
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
# ############################## end of file ############################# #
|
data/SECURITY.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Pantheios.Ruby - Security <!-- omit in toc -->
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
## Table of Contents <!-- omit in toc -->
|
|
5
|
+
|
|
6
|
+
- [Reporting a vulnerability](#reporting-a-vulnerability)
|
|
7
|
+
- [Supported versions](#supported-versions)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## Reporting a vulnerability
|
|
11
|
+
|
|
12
|
+
Please report security issues privately via GitHub Security Advisories on https://github.com/synesissoftware/Pantheios.Ruby/security, or by opening an issue if an advisory cannot be filed. Do not attach exploit proofs of concept against third-party systems.
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## Supported versions
|
|
16
|
+
|
|
17
|
+
| Version | Supported |
|
|
18
|
+
| ------- | --------- |
|
|
19
|
+
| 0.22.x | ✅ |
|
|
20
|
+
| < 0.22 | ❌ |
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
<!-- ########################### end of file ########################### -->
|
data/TODO.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Pantheios.Ruby - TODO <!-- omit in toc -->
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
## Functional improvements
|
|
5
|
+
|
|
6
|
+
* [x] ~~~quiet unused-variable warnings in **simple_file_log_service.rb**
|
|
7
|
+
(`logger_init_options`) and **standard_log_service_adapter.rb** (`sym`)~~~;
|
|
8
|
+
* [x] ~~~quiet **Warnings** job noise in tests: unused `pid` in
|
|
9
|
+
**tc_standard_log_service_adapter.rb**; ambiguous `/` in
|
|
10
|
+
**tc_simple_file_log_service.rb** and **tc_standard_log_service_adapter.rb**~~~;
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## Performance improvements
|
|
14
|
+
|
|
15
|
+
* \<none>
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## Packaging improvements
|
|
19
|
+
|
|
20
|
+
* [ ] catalogue known afferent dependents in **README.md** when any are identified;
|
|
21
|
+
* [x] ~~~handle Ruby **4** stdlib **logger** no longer being a default gem (**Gemfile** when `RUBY_VERSION >= '4'`; not in the gemspec because the **logger** gem requires Ruby **>= 2.5**)~~~;
|
|
22
|
+
* [x] ~~~rename gemspec so the filename stem matches `spec.name` (`Pantheios.Ruby.gemspec` → **pantheios-ruby.gemspec**)~~~;
|
|
23
|
+
* [x] ~~~obtain a **run_all_unit_tests.sh** (from **misc-dev-scripts**) that skips `tput` when `$TERM` is unset or stdout is not a TTY (CI: `tput: No value for $TERM and no -T specified`)~~~;
|
|
24
|
+
* [x] ~~~gemspec polish: README tagline as `spec.summary`, package docs, exclude **Gemfile.lock** / **.ruby-version**~~~;
|
|
25
|
+
* [x] ~~~stop tracking **Gemfile.lock**; **Gemfile** `lockfile false` when Bundler supports it; CI `bundler-cache: false`~~~;
|
|
26
|
+
* [x] ~~~after the packaging/boilerplate/CI baseline: bump **VERSION** and align **CHANGES**/**NEWS**~~~;
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
<!-- ########################### end of file ########################### -->
|
|
@@ -29,7 +29,7 @@ LEVELS = %i{ violation alert critical failure warning notice informational debug
|
|
|
29
29
|
|
|
30
30
|
LEVELS.each do |level|
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
log(level, "logging level #{level}")
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
# ############################## end of file ############################# #
|
|
@@ -14,46 +14,46 @@ module Organisation
|
|
|
14
14
|
|
|
15
15
|
module Helpers
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
include ::Pantheios
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
def with_trace
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
trace
|
|
22
|
+
end
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
def with_debug0; log(:debug0); end
|
|
25
|
+
def with_debug1; log(:debug1); end
|
|
26
|
+
def with_informational; log(:informational); end
|
|
27
|
+
def with_notice; log(:notice); end
|
|
28
|
+
def with_warning; log(:warning); end
|
|
29
|
+
def with_failure; log(:failure); end
|
|
30
|
+
def with_critical; log(:critical); end
|
|
31
|
+
def with_alert; log(:alert); end
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
def helper1
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
trace
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
with_debug0
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
with_notice
|
|
40
|
+
end
|
|
41
41
|
|
|
42
42
|
end # module Helpers
|
|
43
43
|
|
|
44
44
|
class OrgClass
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
include Helpers
|
|
47
|
+
include ::Pantheios
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
def initialize()
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
trace
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
log(:debug2) { 'initialised instance of OrgClass' }
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
helper1
|
|
56
|
+
end
|
|
57
57
|
|
|
58
58
|
end # class OrgClas
|
|
59
59
|
|
|
@@ -79,25 +79,25 @@ SUPPRESSED_SEVERITIES = %i{
|
|
|
79
79
|
|
|
80
80
|
def detect_suppression argv
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
argv.each do |arg|
|
|
83
83
|
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
SUPPRESSED_SEVERITIES << arg.to_sym
|
|
85
|
+
end
|
|
86
86
|
end
|
|
87
87
|
|
|
88
88
|
class FrontEnd
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
def severity_logged? severity
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
case severity
|
|
93
|
+
when ::Symbol
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
!SUPPRESSED_SEVERITIES.include?(severity)
|
|
96
|
+
else
|
|
97
97
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
true
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
101
|
end
|
|
102
102
|
|
|
103
103
|
Pantheios::Core.set_front_end FrontEnd.new
|
|
@@ -125,7 +125,7 @@ with_alert
|
|
|
125
125
|
|
|
126
126
|
log(:info) { "Creating instance of OrgClass" }
|
|
127
127
|
|
|
128
|
-
|
|
128
|
+
Organisation::OrgClass.new
|
|
129
129
|
|
|
130
130
|
# ############################## end of file ############################# #
|
|
131
131
|
|
data/examples/simple_logging.md
CHANGED
data/examples/simple_logging.rb
CHANGED
|
@@ -29,7 +29,7 @@ LEVELS = %i{ violation alert critical failure warning notice informational debug
|
|
|
29
29
|
|
|
30
30
|
LEVELS.each do |level|
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
log(level, "logging level #{level}")
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
# ############################## end of file ############################# #
|
|
@@ -40,7 +40,7 @@ Pantheios::Core.set_front_end Pantheios::FrontEnds::ThresholdFrontEnd.new thresh
|
|
|
40
40
|
|
|
41
41
|
LEVELS.each do |level|
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
log(level, "logging level #{level}")
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
# ############################## end of file ############################# #
|