minato_logger 0.1.13.pre.1 → 0.1.13.pre.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/minato_logger/formatters/fluent_bit.rb +3 -12
- data/lib/minato_logger/rails.rb +15 -0
- data/lib/minato_logger/version.rb +1 -1
- data/lib/minato_logger.rb +15 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c9c3f95a5063eec9edc3da85724cbb7fb9193cea2ed72d53c5d9eeecdfaaef2
|
4
|
+
data.tar.gz: 45af5306aab0c00c9718ddf01fe3b697435cba213e2a4afd5eecf53395976b55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b51adbfc534b440e3c9e1a6c2e46b688c95fb3d8121bfc73c693551c04652018aa5e9b3e68a767fa2150bedd1bfc6975d62eac51815f2aea4af9480bd5db723b
|
7
|
+
data.tar.gz: 83655a46dbe89b6cb9260e9f892d9c29ba9d3b2e05cc02abe34de72d401def53ff6ff1832fbc44b5b7e293ce1cedf83763a96400aa58a3ed561f0285d3b8e4d8
|
@@ -1,9 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "active_support/tagged_logging"
|
4
|
-
require "json"
|
5
4
|
require "google/cloud/trace"
|
6
|
-
require "
|
5
|
+
require "json"
|
7
6
|
|
8
7
|
module MinatoLogger
|
9
8
|
module Formatters
|
@@ -20,17 +19,9 @@ module MinatoLogger
|
|
20
19
|
private
|
21
20
|
|
22
21
|
def add_trace_to_logs(log)
|
23
|
-
return log
|
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
|
-
return log if trace_result.nil?
|
29
|
-
|
30
|
-
trace_log = "projects/#{trace_result.trace.project_id}/traces/#{trace_result.trace.trace_id}"
|
22
|
+
return log if MinatoLogger.config.trace_logs.nil?
|
31
23
|
|
32
|
-
|
33
|
-
"logging.googleapis.com/spanId": trace_result.span_id.to_s })
|
24
|
+
MinatoLogger.config.trace_logs.send(:call, log)
|
34
25
|
end
|
35
26
|
|
36
27
|
def add_message_to_logs(log, message)
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module MinatoLogger
|
4
|
+
class Railtie < ::Rails::Railtie
|
5
|
+
config.minato_logger = ActiveSupport::OrderedOptions.new
|
6
|
+
|
7
|
+
config.after_initialize do |app|
|
8
|
+
app.config.colorize_logging = false
|
9
|
+
|
10
|
+
MinatoLogger.configure do |config|
|
11
|
+
config.trace_logs = app.config.minato_logger.trace_logs
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/minato_logger.rb
CHANGED
@@ -3,3 +3,18 @@
|
|
3
3
|
require_relative "minato_logger/version"
|
4
4
|
require_relative "minato_logger/formatters"
|
5
5
|
require_relative "minato_logger/logger"
|
6
|
+
require_relative "minato_logger/rails" if defined? Rails::Railtie
|
7
|
+
|
8
|
+
module MinatoLogger
|
9
|
+
class Config
|
10
|
+
attr_accessor :trace_logs
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.config
|
14
|
+
@config ||= Config.new
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.configure
|
18
|
+
yield config if block_given?
|
19
|
+
end
|
20
|
+
end
|
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.13.pre.
|
4
|
+
version: 0.1.13.pre.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ferreri
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-02-
|
11
|
+
date: 2024-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -74,6 +74,7 @@ files:
|
|
74
74
|
- lib/minato_logger/formatters/base_formatter.rb
|
75
75
|
- lib/minato_logger/formatters/fluent_bit.rb
|
76
76
|
- lib/minato_logger/logger.rb
|
77
|
+
- lib/minato_logger/rails.rb
|
77
78
|
- lib/minato_logger/version.rb
|
78
79
|
- minato_logger.gemspec
|
79
80
|
- sig/minato_logger.rbs
|