minato_logger 0.1.6 → 0.1.12
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: 343118ecdf395c12f632b045628ba47a76597203a7cc38233257a1b7fd764395
|
4
|
+
data.tar.gz: acf5782ca21283609405cbc0016765bb5fdf0b2019e992c18f0b962605fbeebb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36db69d4f4ca980a0095d3a39a8637c1470c8d96bd28c8a1f452eeba9062ccba9e0a90781ca61a19382d265417731d4e6e01b6eea1a4eedc3db9d8d845b12d88
|
7
|
+
data.tar.gz: 8f8c7ac39931f419009fcf62b1949a3493d3402ff701d0b3f597ecd0804c62be7849bdf9e226fb2fe40d7e7989b0586d66aecb37b78b92f4f1a3e6c6e3e3c878
|
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.to_s })
|
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.12
|
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: []
|