minato_logger 0.1.13.pre.3 → 0.1.13.pre.4
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/configuration.rb +21 -0
- data/lib/minato_logger/formatters/fluent_bit.rb +6 -4
- data/lib/minato_logger/middleware.rb +15 -0
- data/lib/minato_logger/rails.rb +2 -6
- data/lib/minato_logger/version.rb +1 -1
- data/lib/minato_logger.rb +17 -13
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8912274da7dd77fae6f70e2236079b5ed24df2aef0326ef1cd0467aed0cd2dcc
|
4
|
+
data.tar.gz: 9fe88a71c8273fa4945b74d3d640761b6fc8bfb2c2bca0ae63e25cfb3b82fc2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7974899c02eee1e4f366b3391fbbb3c386dbbea2870ce4bc2f61396e4baf495c8b8bac7c32d9239e5b588e8646128e9a8b3f495c3897a5ce19592091a922ec7
|
7
|
+
data.tar.gz: 604ff2aabe0ee95c8f7f748026baa9b9abda1ad6bea00ac698550c686a6d4bc73d962902c30b2d77e0000e7f19f6b1e2e664d7535e46183c1712891ccd7107b6
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module MinatoLogger
|
4
|
+
class Configuration
|
5
|
+
attr_reader :middleware
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@middleware = MinatoLogger::Middleware.new
|
9
|
+
|
10
|
+
yield(self) if block_given?
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.default
|
14
|
+
@default ||= Configuration.new
|
15
|
+
end
|
16
|
+
|
17
|
+
def configure
|
18
|
+
yield(self) if block_given?
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -11,17 +11,19 @@ module MinatoLogger
|
|
11
11
|
|
12
12
|
def call(severity, timestamp, _progname, message)
|
13
13
|
log = add_message_to_logs({ severity: severity, time: timestamp }, message)
|
14
|
-
log =
|
14
|
+
log = apply_middlewares(log)
|
15
15
|
|
16
16
|
"#{log.to_json}\n"
|
17
17
|
end
|
18
18
|
|
19
19
|
private
|
20
20
|
|
21
|
-
def
|
22
|
-
|
21
|
+
def apply_middlewares(log)
|
22
|
+
MinatoLogger.config.middleware.middlewares.each do |middleware|
|
23
|
+
log = middleware.new.call(log)
|
24
|
+
end
|
23
25
|
|
24
|
-
|
26
|
+
log
|
25
27
|
end
|
26
28
|
|
27
29
|
def add_message_to_logs(log, message)
|
data/lib/minato_logger/rails.rb
CHANGED
@@ -2,14 +2,10 @@
|
|
2
2
|
|
3
3
|
module MinatoLogger
|
4
4
|
class Railtie < ::Rails::Railtie
|
5
|
-
config.minato_logger =
|
5
|
+
config.minato_logger = MinatoLogger::Configuration.default
|
6
6
|
|
7
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
|
8
|
+
app.config.colorize_logging = false if Rails.env.production?
|
13
9
|
end
|
14
10
|
end
|
15
11
|
end
|
data/lib/minato_logger.rb
CHANGED
@@ -1,20 +1,24 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
require "minato_logger/version"
|
4
|
+
require "minato_logger/middleware"
|
5
|
+
require "minato_logger/configuration"
|
6
|
+
require "minato_logger/formatters"
|
7
|
+
require "minato_logger/logger"
|
8
|
+
require "minato_logger/rails" if defined? Rails::Railtie
|
7
9
|
|
8
10
|
module MinatoLogger
|
9
|
-
class
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
class << self
|
12
|
+
def configure
|
13
|
+
if block_given?
|
14
|
+
yield(Configuration.default)
|
15
|
+
else
|
16
|
+
Configuration.default
|
17
|
+
end
|
18
|
+
end
|
16
19
|
|
17
|
-
|
18
|
-
|
20
|
+
def config
|
21
|
+
@config ||= Configuration.default
|
22
|
+
end
|
19
23
|
end
|
20
24
|
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.4
|
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-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -70,10 +70,12 @@ files:
|
|
70
70
|
- Rakefile
|
71
71
|
- compose.yml
|
72
72
|
- lib/minato_logger.rb
|
73
|
+
- lib/minato_logger/configuration.rb
|
73
74
|
- lib/minato_logger/formatters.rb
|
74
75
|
- lib/minato_logger/formatters/base_formatter.rb
|
75
76
|
- lib/minato_logger/formatters/fluent_bit.rb
|
76
77
|
- lib/minato_logger/logger.rb
|
78
|
+
- lib/minato_logger/middleware.rb
|
77
79
|
- lib/minato_logger/rails.rb
|
78
80
|
- lib/minato_logger/version.rb
|
79
81
|
- minato_logger.gemspec
|