berkeley_library-logging 0.2.6.2 → 0.2.7

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: 48c51023acdd7645c3bb8b848866530073434912b93498b4b12a739dd117da52
4
- data.tar.gz: 40fc965452fba9f55877ef598eb594e510a67d1e8f77add187efe1b34f4395b5
3
+ metadata.gz: 278ef46ccce64fab4aa75c6d93f7ed7cf12803588840f7010ee7728001957dd6
4
+ data.tar.gz: 8d0ffc097c007d160c0a655a7404652ee7d80afe142b54200fa813f457ed4c21
5
5
  SHA512:
6
- metadata.gz: f9ecb21c588ccc52ee496c6fd4eb1e9bd47a771147da4707814931b48e58b0a50b4f5d5ce9d7f5974bdaa4fc1ee82ad456e5ac42f4d73931a69cde6652e3a2da
7
- data.tar.gz: b4ffb91ebc7c1d4c98ca314f587ad66dfe92755556d345dd8b459412cf9ff657ed8f70e2c6ccd6060aed44167cc135911f90aeb9ab56e580c3388a6eba361928
6
+ metadata.gz: bf627a3dfb63ef584e9a257db8f5a0268d66de51a87ba71815f95055d56cb5c4c4abcb437f1b4ac860b18e568e9b790617e93fc35b5aaf9858ed0ab9564c5597
7
+ data.tar.gz: 983f06d6e8fce525da56be1c1e661d6ee15ac348b751e9c86ecb95d180f187e9db5a95d823814cc7a93a116e8959a4c0978fdba94e8e152e7d449bb472e29c4c
data/CHANGES.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.2.7 (2022-05-25)
2
+
3
+ - Set `BerkeleyLibrary::Logging.logger` on Railtie initialization
4
+
1
5
  # 0.2.6.2 (2022-05-25)
2
6
 
3
7
  - Fix `NoMethodError` when calling `BerkeleyLibrary::Logging::Loggers.default_logger` before
@@ -8,13 +8,17 @@ module BerkeleyLibrary
8
8
  class Configurator
9
9
  class << self
10
10
 
11
+ # Applies the log configuration to the specified Rails config.
12
+ #
13
+ # @return [BerkeleyLibrary::Logging::Logger] the configured logger
11
14
  def configure(config)
12
15
  configure_lograge(config)
13
16
 
14
- logger = Loggers.new_default_logger(config)
15
- logger.info("Custom logger initialized for environment #{Logging.env.inspect}")
16
- configure_webpacker(logger)
17
- config.logger = logger
17
+ Loggers.new_default_logger(config).tap do |logger|
18
+ logger.info("Custom logger initialized for environment #{Logging.env.inspect}")
19
+ configure_webpacker(logger)
20
+ config.logger = logger
21
+ end
18
22
  end
19
23
 
20
24
  private
@@ -7,7 +7,7 @@ module BerkeleyLibrary
7
7
  SUMMARY = 'Opinionated Ruby/Rails logging for UC Berkeley Library'.freeze
8
8
  DESCRIPTION = 'A gem providing shared logging code for UC Berkeley Library gems and Rails applications'.freeze
9
9
  LICENSE = 'MIT'.freeze
10
- VERSION = '0.2.6.2'.freeze
10
+ VERSION = '0.2.7'.freeze
11
11
  HOMEPAGE = 'https://github.com/BerkeleyLibrary/logging'.freeze
12
12
 
13
13
  private_class_method :new
@@ -8,7 +8,8 @@ module BerkeleyLibrary
8
8
  # Don't use the Railtie's own `config` because configure() needs
9
9
  # Rails::Application::Configuration#default_log_file
10
10
  initializer('logging.configure_berkeley_library_logging', before: :initialize_logger) do |app|
11
- Configurator.configure(app.config)
11
+ logger = Configurator.configure(app.config)
12
+ BerkeleyLibrary::Logging.logger = logger
12
13
  end
13
14
  end
14
15
  end
@@ -23,6 +23,11 @@ module BerkeleyLibrary
23
23
  expect(config.logger).to be_a(Logging::Logger)
24
24
  end
25
25
 
26
+ it 'returns the logger' do
27
+ logger = Configurator.configure(config)
28
+ expect(logger).to be(config.logger)
29
+ end
30
+
26
31
  describe :configure_lograge! do
27
32
  it 'enables Lograge' do
28
33
  Configurator.configure(config)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: berkeley_library-logging
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6.2
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Moles