bbk-utils 1.0.1.147183 → 1.1.0.149110

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e9e803d8681188bee3d02f0136ca8e23e879895bde7d7f36f954430c17ae375f
4
- data.tar.gz: 917d6a58f8b48a3162c46504c9ea5a499b9c4444d8ed3e016e107f7d9e1a73a6
3
+ metadata.gz: b5a90e5fb2e9e12fcce7025e4db9358853b9b277c43660cb23d168dabd2957ed
4
+ data.tar.gz: 9133ac9e0fca489c65abe5b6702429fbb750537b1f092d5a6b0481caaf8c746c
5
5
  SHA512:
6
- metadata.gz: 6ab6b068166a4bd68677644cac4f00a810f54e921353bdad6e7772aac947d55c9618c447c6277ff899b249122fb1de98bd2153147ada6a8ed3318e774cf33e8c
7
- data.tar.gz: 12b7f0f487d56d9edd31183f7d428ed9a7bf5639c5e6496cabccb306e8d3cc764eca18c373513b4982323b2f9bf2ee0b51d379afc7b661cd16ab411a4ff53874
6
+ metadata.gz: 760c5aedb896030e63fde2ba5ad280f0e2ecc5ad19834c6e72fd7a6eb9551549b7750d085253a72999a49633f08862dc6eb5af9053615d70cf07fa9c41a381f7
7
+ data.tar.gz: f83185cf18a0658798b325ce78308d72e29585aea238340a90c33b9c56e654886d717b5bd1886617052f0fb4a5f646a2f176f1b177fafc2c4efba1c543b64cc3
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bbk-utils (1.0.1.147183)
5
- activesupport (>= 6.0)
4
+ bbk-utils (1.1.0.149110)
5
+ activesupport (>= 7.0)
6
6
  russian
7
7
 
8
8
  GEM
@@ -24,7 +24,7 @@ GEM
24
24
  byebug (11.1.3)
25
25
  coercible (1.0.0)
26
26
  descendants_tracker (~> 0.0.1)
27
- concurrent-ruby (1.1.9)
27
+ concurrent-ruby (1.2.2)
28
28
  descendants_tracker (0.0.4)
29
29
  thread_safe (~> 0.3, >= 0.3.1)
30
30
  diff-lcs (1.4.4)
@@ -42,7 +42,7 @@ GEM
42
42
  path_expander (~> 1.0)
43
43
  ruby_parser (~> 3.1, > 3.1.0)
44
44
  sexp_processor (~> 4.8)
45
- i18n (1.8.11)
45
+ i18n (1.14.1)
46
46
  concurrent-ruby (~> 1.0)
47
47
  ice_nine (0.11.2)
48
48
  kwalify (0.7.2)
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'logger'
4
+
5
+ module BBK
6
+ module Utils
7
+ class CombinedLogger
8
+
9
+ include ::Logger::Severity
10
+
11
+ attr_reader :loggers, :progname, :level, :formatter
12
+
13
+ def self.new(*args, **kwargs)
14
+ ActiveSupport::TaggedLogging.new(super)
15
+ end
16
+
17
+ def initialize(progname, *loggers, formatter: LogFormatter.new, level: Logger::Severity::INFO)
18
+ @loggers = loggers
19
+ self.progname = progname
20
+ self.level = level
21
+ self.formatter = formatter
22
+ end
23
+
24
+ def progname=(name)
25
+ @progname = name
26
+ @loggers.each {|logger| logger.progname = name}
27
+ end
28
+
29
+ def formatter=(formatter)
30
+ @formatter = formatter
31
+ @loggers.each {|logger| logger.formatter = formatter}
32
+ end
33
+
34
+ def level=(level)
35
+ log_level = if level.is_a?(Integer) || (Integer(level) rescue false)
36
+ level
37
+ else
38
+ self.class.const_get(level.to_s.upcase)
39
+ end
40
+ @level = log_level
41
+ @loggers.each {|logger| logger.level = log_level }
42
+ end
43
+
44
+ alias sev_threshold level
45
+ alias sev_threshold= level=
46
+
47
+ %i[debug info warn error fatal].each do |level|
48
+ define_method(level) do |*args, &block|
49
+ loggers.each {|logger| logger.send(level, *args, &block)}
50
+ nil
51
+ end
52
+
53
+ define_method("#{level}?") do
54
+ self.level <= self.class.const_get(level.upcase.to_sym)
55
+ end
56
+
57
+ define_method("#{level}!") do
58
+ self.level = self.class.const_get(level.upcase.to_sym)
59
+ end
60
+
61
+ end
62
+
63
+ def method_missing(name, *args, **kwargs, &block)
64
+ @loggers.each {|logger| logger.send(name, *args, **kwargs, &block)}
65
+ nil
66
+ end
67
+
68
+ def clone
69
+ super.tap do |it|
70
+ it.instance_variable_set(:@loggers, loggers.map(&:clone))
71
+ end
72
+ end
73
+
74
+ end
75
+ end
76
+ end
@@ -3,7 +3,7 @@
3
3
  module BBK
4
4
  module Utils
5
5
 
6
- VERSION = '1.0.1'
6
+ VERSION = '1.1.0'.freeze
7
7
 
8
8
  end
9
9
  end
data/lib/bbk/utils.rb CHANGED
@@ -5,6 +5,7 @@ require 'active_support/core_ext'
5
5
  require 'bbk/utils/config'
6
6
  require 'bbk/utils/crypt'
7
7
  require 'bbk/utils/logger'
8
+ require 'bbk/utils/combined_logger'
8
9
  require 'bbk/utils/proxy_logger'
9
10
  require 'bbk/utils/version'
10
11
  require 'bbk/utils/xml'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bbk-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1.147183
4
+ version: 1.1.0.149110
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samoilenko Yuri
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-31 00:00:00.000000000 Z
11
+ date: 2023-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '6.0'
19
+ version: '7.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '6.0'
26
+ version: '7.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: russian
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -219,6 +219,7 @@ files:
219
219
  - bin/console
220
220
  - bin/setup
221
221
  - lib/bbk/utils.rb
222
+ - lib/bbk/utils/combined_logger.rb
222
223
  - lib/bbk/utils/config.rb
223
224
  - lib/bbk/utils/crypt.rb
224
225
  - lib/bbk/utils/env_helper.rb