uc3-dmp-cloudwatch 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/uc3-dmp-cloudwatch/logger.rb +6 -5
- data/lib/uc3-dmp-cloudwatch/version.rb +1 -1
- data/lib/uc3-dmp-cloudwatch.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e70f9410b18afceae006186c8b9fa672563078b678eed1478508510e0c10c4f
|
4
|
+
data.tar.gz: d99d0f4c64c863cffc986906256fa98dce43a9fd9121954ce67ff0d2b6e04309
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74846d9af82cc3927636c9999d3d8a292951cd3449da63c88acfbb441e6ce751164ef68301e300f225f84d628d91825013e8aaa6825db26b3cf00d7480fd4172
|
7
|
+
data.tar.gz: 43b20e1e0dfc6cb32e3ce3d843e0e005ee0d25bba234beb2bf16e1960d79942fc11f99d65e41dffe19099a6f86ae3e5f9488210f1c2441f7b38ffca859bb53f6
|
@@ -7,7 +7,7 @@ module Uc3DmpCloudwatch
|
|
7
7
|
class Logger
|
8
8
|
attr_accessor :source, :event, :request_id, :level
|
9
9
|
|
10
|
-
LOG_LEVELS = %w[none error info debug]
|
10
|
+
LOG_LEVELS = %w[none error info debug].freeze
|
11
11
|
|
12
12
|
def initialize(**args)
|
13
13
|
@level = args.fetch(:level, 'info')&.to_s&.downcase
|
@@ -22,7 +22,7 @@ module Uc3DmpCloudwatch
|
|
22
22
|
return false if @level == 'none' || message.nil?
|
23
23
|
|
24
24
|
_format_msg(mode: 'error', msg: message)
|
25
|
-
_format_msg(mode: 'error', msg: details) if _valid_details(details:
|
25
|
+
_format_msg(mode: 'error', msg: details) if _valid_details(details:)
|
26
26
|
_log_event(mode: 'error')
|
27
27
|
end
|
28
28
|
|
@@ -30,14 +30,14 @@ module Uc3DmpCloudwatch
|
|
30
30
|
return false if %w[none error].include?(@level) || message.nil?
|
31
31
|
|
32
32
|
_format_msg(mode: 'info', msg: message)
|
33
|
-
_format_msg(mode: 'info', msg: details) if _valid_details(details:
|
33
|
+
_format_msg(mode: 'info', msg: details) if _valid_details(details:)
|
34
34
|
end
|
35
35
|
|
36
36
|
def debug(message:, details: {})
|
37
37
|
return false if %w[none error info].include?(@level) || message.nil?
|
38
38
|
|
39
39
|
_format_msg(mode: 'debug', msg: message)
|
40
|
-
_format_msg(mode: 'debug', msg: details) if _valid_details(details:
|
40
|
+
_format_msg(mode: 'debug', msg: details) if _valid_details(details:)
|
41
41
|
end
|
42
42
|
|
43
43
|
private
|
@@ -54,10 +54,11 @@ module Uc3DmpCloudwatch
|
|
54
54
|
def _prefix(prefix: 'INFO')
|
55
55
|
prefix = @request_id.nil? ? "#{prefix} " : "#{prefix} RequestId: #{@request_id},"
|
56
56
|
prefix += " SOURCE: #{@source}," unless @source.nil?
|
57
|
+
prefix
|
57
58
|
end
|
58
59
|
|
59
60
|
# Format the message
|
60
|
-
def _format_msg(mode: 'info'
|
61
|
+
def _format_msg(msg:, mode: 'info')
|
61
62
|
message = msg.is_a?(Array) ? msg.join(', ') : msg
|
62
63
|
puts "#{_prefix(prefix: mode.upcase)} #{message.is_a?(String) ? "MESSAGE: #{message}" : "PAYLOAD: #{message}"}"
|
63
64
|
end
|
data/lib/uc3-dmp-cloudwatch.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uc3-dmp-cloudwatch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Riley
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|
@@ -82,7 +82,7 @@ licenses:
|
|
82
82
|
- MIT
|
83
83
|
metadata:
|
84
84
|
rubygems_mfa_required: 'false'
|
85
|
-
post_install_message:
|
85
|
+
post_install_message:
|
86
86
|
rdoc_options: []
|
87
87
|
require_paths:
|
88
88
|
- lib
|
@@ -90,15 +90,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
90
90
|
requirements:
|
91
91
|
- - ">="
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version: '2
|
93
|
+
version: '3.2'
|
94
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
95
|
requirements:
|
96
96
|
- - ">="
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: '0'
|
99
99
|
requirements: []
|
100
|
-
rubygems_version: 3.
|
101
|
-
signing_key:
|
100
|
+
rubygems_version: 3.4.10
|
101
|
+
signing_key:
|
102
102
|
specification_version: 4
|
103
103
|
summary: DMPTool gem that provides support for writing standardized logs to CloudWatch
|
104
104
|
test_files: []
|