insights-loggers-ruby 0.1.1 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -11
- data/insights-loggers-ruby.gemspec +3 -3
- data/lib/insights/loggers.rb +1 -1
- data/lib/insights/loggers/{base.rb → factory.rb} +4 -5
- data/lib/insights/loggers/{logging_service.rb → std_error_logger.rb} +1 -1
- data/lib/insights/loggers/version.rb +1 -1
- metadata +15 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4c5770a83d1155b302ab246cde573db7d4ba736ffb709921dced6e594c72626
|
4
|
+
data.tar.gz: cdcb01d4be0d549247510a1b605eb2964074079cf350cebd1560dcae480e961b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 783f3771ab119d5a36550941919cd474f387e6899e7fbf42bf5ccfe3761995a2b591ad81c593d4d5ab18e5462976b4749ab6b9109739d0157c137d8b89f8a253
|
7
|
+
data.tar.gz: 0f359ef12081f15d39f173374447b5bdb4d0bd4aa1fc50bee770dc5ca84f0c7e7814ebe7dc4ab287a4964ac747f1d3717a63aa1582772a06ecf370ead289f36f
|
data/README.md
CHANGED
@@ -25,15 +25,15 @@ Or install it yourself as:
|
|
25
25
|
### Example
|
26
26
|
```ruby
|
27
27
|
require 'insights/loggers'
|
28
|
-
logger_class = "Insights::Loggers::
|
29
|
-
logger = Insights::Loggers::
|
30
|
-
logger.class #=> Insights::Loggers::
|
28
|
+
logger_class = "Insights::Loggers::StdErrorLogger"
|
29
|
+
logger = Insights::Loggers::Factory.create_logger(logger_class)
|
30
|
+
logger.class #=> Insights::Loggers::StdErrorLogger
|
31
31
|
logger.info("test")
|
32
32
|
#{"@timestamp":"2021-04-28T12:56:28.682015 ","pid":11561,"tid":"3fd1d4c2ffd4","level":"info","message":"test","tags":["insights_application"],"labels":{"app":"insights_application"}}
|
33
33
|
#^^^standard error output (it is not return value)
|
34
34
|
#=> true
|
35
35
|
#
|
36
|
-
logger = Insights::Loggers::
|
36
|
+
logger = Insights::Loggers::Factory.create_logger(logger_class, {:app_name => "MyApp"})
|
37
37
|
logger.warn("test")
|
38
38
|
#{"@timestamp":"2021-04-28T13:31:40.311131 ","pid":11561,"tid":"3fd1d4c2ffd4","level":"warning","message":"test","tags":["MyApp"],"labels":{"app":"MyApp"}}
|
39
39
|
#^^^standard error output
|
@@ -45,14 +45,14 @@ ManageIQ::Loggers::Base
|
|
45
45
|
ManageIQ::Loggers::Container
|
46
46
|
ManageIQ::Loggers::CloudWatch
|
47
47
|
ManageIQ::Loggers::Journald
|
48
|
-
Insights::Loggers::
|
48
|
+
Insights::Loggers::StdErrorLogger
|
49
49
|
TopologicalInventory::Providers::Common::Logger
|
50
50
|
```
|
51
51
|
|
52
52
|
First for refers to gem `manageiq-loggers` and
|
53
53
|
last one refers to `topological_inventory-providers-common` gem.
|
54
54
|
|
55
|
-
`insights-loggers-ruby` adds own logger `Insights::Loggers::
|
55
|
+
`insights-loggers-ruby` adds own logger `Insights::Loggers::StdErrorLogger`
|
56
56
|
which is producing log to standard error output.
|
57
57
|
This standard error output can be consumed by [haberdasher](https://github.com/RedHatInsights/haberdasher) tool.
|
58
58
|
|
@@ -61,18 +61,18 @@ This standard error output can be consumed by [haberdasher](https://github.com/R
|
|
61
61
|
Logger object can be built with method:
|
62
62
|
|
63
63
|
```
|
64
|
-
Insights::Loggers::
|
64
|
+
Insights::Loggers::Factory.create_logger
|
65
65
|
```
|
66
66
|
First parameter is `logger_class` and second parameter is
|
67
67
|
hash with parameters.
|
68
68
|
Supported hash parameters are:
|
69
69
|
|
70
70
|
- `:log_path` - required for `ManageIQ::Loggers::Base` logger, it specifies the path to log file
|
71
|
-
- `:app_name` - applicable for `Insights::Loggers::
|
71
|
+
- `:app_name` - applicable for `Insights::Loggers::StdErrorLogger`, it specifies the tags and labels values in formatted output
|
72
72
|
|
73
|
-
### Formatted output for `Insights::Loggers::
|
73
|
+
### Formatted output for `Insights::Loggers::StdErrorLogger` logger
|
74
74
|
|
75
|
-
|
75
|
+
Standard error logger produces formatted output:
|
76
76
|
|
77
77
|
```
|
78
78
|
{"@timestamp":"2021-04-28T13:31:40.311131 ",
|
@@ -91,7 +91,7 @@ when app_name is not set in hash parameters.
|
|
91
91
|
|
92
92
|
## Dependencies
|
93
93
|
|
94
|
-
|
94
|
+
Standard error logger inherits from `ManageIQ::Loggers::Container` class and
|
95
95
|
thanks to that `manageiq-loggers` is required dependency.
|
96
96
|
|
97
97
|
Usage other loggers is possible also from `manageiq-loggers` gem.
|
@@ -22,11 +22,11 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ["lib"]
|
24
24
|
|
25
|
-
spec.add_runtime_dependency "activesupport", "~> 5.
|
26
|
-
spec.add_runtime_dependency "topological_inventory-providers-common", "~>
|
25
|
+
spec.add_runtime_dependency "activesupport", "~> 5.2", ">= 5.2.4.3"
|
26
|
+
spec.add_runtime_dependency "topological_inventory-providers-common", "~> 3.0.1"
|
27
27
|
spec.add_runtime_dependency "manageiq-loggers", "~> 0.4", ">= 0.4.2"
|
28
28
|
|
29
|
-
spec.
|
29
|
+
spec.add_runtime_dependency "cloudwatchlogger", "~> 0.3.0"
|
30
30
|
spec.add_development_dependency "manageiq-style", "~> 1.3.0"
|
31
31
|
spec.add_development_dependency "rake", "~> 12.3", ">= 12.3.3"
|
32
32
|
spec.add_development_dependency "rspec", "~> 3.0"
|
data/lib/insights/loggers.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
require "insights/loggers/version"
|
2
|
-
require "insights/loggers/
|
2
|
+
require "insights/loggers/factory"
|
@@ -1,8 +1,6 @@
|
|
1
|
-
require 'pry-nav'
|
2
|
-
|
3
1
|
module Insights
|
4
2
|
module Loggers
|
5
|
-
class
|
3
|
+
class Factory
|
6
4
|
def self.create_logger(logger_class, args = nil)
|
7
5
|
logger_library_loader(logger_class)
|
8
6
|
klass = logger_class.safe_constantize
|
@@ -37,6 +35,7 @@ module Insights
|
|
37
35
|
require "manageiq/loggers/container"
|
38
36
|
when "ManageIQ::Loggers::CloudWatch"
|
39
37
|
require "manageiq/loggers/base"
|
38
|
+
require "manageiq/loggers/container"
|
40
39
|
require "manageiq/loggers/cloud_watch"
|
41
40
|
when "ManageIQ::Loggers::Journald"
|
42
41
|
unless RbConfig::CONFIG['host_os'] =~ /linux/i
|
@@ -45,10 +44,10 @@ module Insights
|
|
45
44
|
|
46
45
|
require "manageiq/loggers/base"
|
47
46
|
require "manageiq/loggers/journald"
|
48
|
-
when "Insights::Loggers::
|
47
|
+
when "Insights::Loggers::StdErrorLogger"
|
49
48
|
require "manageiq/loggers/base"
|
50
49
|
require "manageiq/loggers/container"
|
51
|
-
require "insights/loggers/
|
50
|
+
require "insights/loggers/std_error_logger"
|
52
51
|
when "TopologicalInventory::Providers::Common::Logger"
|
53
52
|
require "topological_inventory/providers/common/logging"
|
54
53
|
else
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: insights-loggers-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Insights Authors
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,28 +16,34 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '5.
|
19
|
+
version: '5.2'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 5.2.4.3
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
27
|
- - "~>"
|
25
28
|
- !ruby/object:Gem::Version
|
26
|
-
version: '5.
|
29
|
+
version: '5.2'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 5.2.4.3
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: topological_inventory-providers-common
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
37
|
- - "~>"
|
32
38
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
39
|
+
version: 3.0.1
|
34
40
|
type: :runtime
|
35
41
|
prerelease: false
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
37
43
|
requirements:
|
38
44
|
- - "~>"
|
39
45
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
46
|
+
version: 3.0.1
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: manageiq-loggers
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -65,7 +71,7 @@ dependencies:
|
|
65
71
|
- - "~>"
|
66
72
|
- !ruby/object:Gem::Version
|
67
73
|
version: 0.3.0
|
68
|
-
type: :
|
74
|
+
type: :runtime
|
69
75
|
prerelease: false
|
70
76
|
version_requirements: !ruby/object:Gem::Requirement
|
71
77
|
requirements:
|
@@ -172,8 +178,8 @@ files:
|
|
172
178
|
- insights-loggers-ruby.gemspec
|
173
179
|
- lib/insights-loggers.rb
|
174
180
|
- lib/insights/loggers.rb
|
175
|
-
- lib/insights/loggers/
|
176
|
-
- lib/insights/loggers/
|
181
|
+
- lib/insights/loggers/factory.rb
|
182
|
+
- lib/insights/loggers/std_error_logger.rb
|
177
183
|
- lib/insights/loggers/version.rb
|
178
184
|
homepage: https://github.com/ManageIQ/manageiq-loggers
|
179
185
|
licenses:
|