minato_logger 0.1.6 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/lib/minato_logger/formatters/fluent_bit.rb +26 -2
- data/lib/minato_logger/version.rb +1 -1
- data/minato_logger.gemspec +2 -0
- metadata +35 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59178a10bd084afc13d43017c25388b5bed247eb43583de8402125f2d9a07971
|
4
|
+
data.tar.gz: f1e33cc3de674fb9b8e7445a9b8559984cb0ff2669130877e3366281e4ff3823
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ccafe6a90a61c1e807c7eb6b037c7ee6384d483c2f7b21ffa6a9c11394454a2af4c2162b55fef5ff0b9f5fb324f1a749fd4383890349ed87f59ca51deaf5b23
|
7
|
+
data.tar.gz: d1d2650a5d99c75eebae10c6ea4ab1f6caa4a25dc0d34829def94f0c6f377ca8005979a7b4d1550c1efbeb3628946666955c51062ecb7951ca96b8e3e5dc2200
|
data/.rubocop.yml
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
require "active_support/tagged_logging"
|
4
4
|
require "json"
|
5
|
+
require "google/cloud/trace"
|
6
|
+
require "rails"
|
5
7
|
|
6
8
|
module MinatoLogger
|
7
9
|
module Formatters
|
@@ -9,8 +11,30 @@ module MinatoLogger
|
|
9
11
|
include ActiveSupport::TaggedLogging::Formatter
|
10
12
|
|
11
13
|
def call(severity, timestamp, _progname, message)
|
12
|
-
log = { severity: severity, time: timestamp,
|
13
|
-
|
14
|
+
log = add_message_to_logs({ severity: severity, time: timestamp }, message)
|
15
|
+
log = add_trace_to_logs(log)
|
16
|
+
|
17
|
+
"#{log.to_json}\n"
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def add_trace_to_logs(log)
|
23
|
+
return log unless ::Rails.env == "production"
|
24
|
+
|
25
|
+
# Get Cloud Trace info to integrate with Cloud Logging
|
26
|
+
_trace_client = Google::Cloud::Trace.new
|
27
|
+
trace_result = Google::Cloud::Trace.get
|
28
|
+
trace_log = "projects/#{trace_result.trace.project_id}/traces/#{trace_result.trace.trace_id}"
|
29
|
+
|
30
|
+
log.merge({ "logging.googleapis.com/trace": trace_log,
|
31
|
+
"logging.googleapis.com/spanId": trace_result.span_id })
|
32
|
+
end
|
33
|
+
|
34
|
+
def add_message_to_logs(log, message)
|
35
|
+
return log.merge(message) unless message.is_a? String
|
36
|
+
|
37
|
+
log.merge({ message: message, ruby_version: RUBY_VERSION })
|
14
38
|
end
|
15
39
|
end
|
16
40
|
end
|
data/minato_logger.gemspec
CHANGED
@@ -31,6 +31,8 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.require_paths = ["lib"]
|
32
32
|
|
33
33
|
spec.add_dependency "activesupport", "~> 7.0.4"
|
34
|
+
spec.add_dependency "rails", ">= 7.0.0"
|
35
|
+
spec.add_dependency "stackdriver", "~> 0.21.1"
|
34
36
|
|
35
37
|
# Uncomment to register a new dependency of your gem
|
36
38
|
# spec.add_dependency "example-gem", "~> 1.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minato_logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ferreri
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -24,7 +24,35 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 7.0.4
|
27
|
-
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rails
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 7.0.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 7.0.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: stackdriver
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.21.1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.21.1
|
55
|
+
description:
|
28
56
|
email:
|
29
57
|
- contato@ferreri.co
|
30
58
|
executables: []
|
@@ -57,7 +85,7 @@ metadata:
|
|
57
85
|
source_code_uri: https://gitlab.com/ferreri/minato/minato-logger-rails
|
58
86
|
changelog_uri: https://gitlab.com/ferreri/minato/minato-logger-rails/-/blob/main/CHANGELOG.md?ref_type=heads
|
59
87
|
rubygems_mfa_required: 'true'
|
60
|
-
post_install_message:
|
88
|
+
post_install_message:
|
61
89
|
rdoc_options: []
|
62
90
|
require_paths:
|
63
91
|
- lib
|
@@ -72,8 +100,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
100
|
- !ruby/object:Gem::Version
|
73
101
|
version: '0'
|
74
102
|
requirements: []
|
75
|
-
rubygems_version: 3.
|
76
|
-
signing_key:
|
103
|
+
rubygems_version: 3.4.19
|
104
|
+
signing_key:
|
77
105
|
specification_version: 4
|
78
106
|
summary: Log enhancements for Minato Rails Apps.
|
79
107
|
test_files: []
|