minato_logger 0.2.13 → 0.2.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30d7463ea874ebb8c5c225639287ef19ad5298f0194a8a40f58780cde4b21079
4
- data.tar.gz: 4626828e63f5fe5cca9d0ea669094d3e95331c3fe6f9d006a0971160276f9615
3
+ metadata.gz: 4353d7f52d8e5b812f3dcbcb4d8b858f26aeba0e8bb69f3d8ee3c251997d60f3
4
+ data.tar.gz: 3abd0c444b2595ed337a95a74d2a79b7a1178178af9236fbdc1ccf498dfa0c77
5
5
  SHA512:
6
- metadata.gz: b4439e60fce5ed2f4db05ddeb07ed1244aab12fb91eacca38f480de434e52b9c9b4aea810872c5f0a1ca613b45451357735dc3b15687a470313af25a51318242
7
- data.tar.gz: 1c4a700119bacd6cbbc877fbab3da93e2e0b8e86c50153acaeb616596dd84d38334fd5b72d11f6558deb345fe973e0fa043f4628c27b9e91cfb02f8fa8a86d2b
6
+ metadata.gz: 26d919b4c5e727e0539b6737c5cb5d7379e6ef5500b1d97d9c9de73a411a4914202a64b54076600629f25a7de81f2a304ed9caf503733f01b13c98edc398ef59
7
+ data.tar.gz: 8bdf7d8ccca898cb5eba5e9e4adca003ffa6537d024a580af3fb3a1ef759437a8fc11fba161fd18df7d6c1f21bb09145d795052b939773bc1033b372d8617859
@@ -2,10 +2,11 @@
2
2
 
3
3
  module MinatoLogger
4
4
  class Configuration
5
- attr_reader :middleware
5
+ attr_reader :middleware, :route_blacklist
6
6
 
7
7
  def initialize
8
8
  @middleware = MinatoLogger::Middleware.new
9
+ @route_blacklist = %w[/health/alive /health/ready]
9
10
 
10
11
  yield(self) if block_given?
11
12
  end
@@ -9,8 +9,8 @@ module MinatoLogger
9
9
  class Logger < ActiveSupport::Logger
10
10
  include ActiveSupport::TaggedLogging
11
11
 
12
- def initialize
13
- super($stdout)
12
+ def initialize(out = nil)
13
+ super(out || $stdout)
14
14
  @formatter = Formatters::FluentBit.new
15
15
  end
16
16
  end
@@ -15,14 +15,13 @@ module MinatoLogger
15
15
  private
16
16
 
17
17
  def call_app(request, env)
18
- log_request(request, env)
18
+ shoud_log_request = shoud_log_request?(request)
19
+ log_request(request, env) if shoud_log_request
19
20
  handle = dispatch_request_event(request)
20
21
  data = process_request(env)
21
- [data[:status], data[:headers], [data[:body]]]
22
- ensure
23
- duration = ((current_time - data[:start_time]) * 1000).round(2)
24
- log_response(request, env, data.merge({ duration: duration }))
22
+ log_response(request, env, data) if shoud_log_request
25
23
  finish_request_instrumentation(handle, env['rails.rack_logger_tag_count'])
24
+ [data[:status], data[:headers], [data[:body]]]
26
25
  end
27
26
 
28
27
  def compute_tags(request)
@@ -35,6 +34,15 @@ module MinatoLogger
35
34
  end
36
35
  end
37
36
 
37
+ def shoud_log_request?(request)
38
+ blacklist = Rails.application.config.minato_logger.route_blacklist || []
39
+ blacklist.none? do |item|
40
+ next item.call(request) if item.is_a?(Proc)
41
+
42
+ request.path == item
43
+ end
44
+ end
45
+
38
46
  def process_request(env)
39
47
  data = { body: '', status: 500, start_time: current_time, headers: {} }
40
48
 
@@ -60,6 +68,7 @@ module MinatoLogger
60
68
  end
61
69
 
62
70
  def log_response(request, env, data)
71
+ data[:duration] = ((current_time - data[:start_time]) * 1000).round(2)
63
72
  payload = build_response_payload(request, env, data)
64
73
  log_level = data[:status] >= 500 ? :error : :info
65
74
  log(payload, log_level)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MinatoLogger
4
- VERSION = '0.2.13'
4
+ VERSION = '0.2.14'
5
5
  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.2.13
4
+ version: 0.2.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ferreri
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-02-12 00:00:00.000000000 Z
11
+ date: 2026-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport