berkeley_library-logging 0.2.6 → 0.2.7

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: d0c07ea57fc24dbcd3cbd201045a4d44cea5d51dbc3e7b815a960c9d25438cf5
4
- data.tar.gz: 23468b0d4edfec0da822e70ffaafae44ad5b48c831e1b5edb7a5fcfbacff4b7d
3
+ metadata.gz: 278ef46ccce64fab4aa75c6d93f7ed7cf12803588840f7010ee7728001957dd6
4
+ data.tar.gz: 8d0ffc097c007d160c0a655a7404652ee7d80afe142b54200fa813f457ed4c21
5
5
  SHA512:
6
- metadata.gz: 044a6796b15f69563548f8b2fb53a734f7dd26d81fdcc414ae741df17983da0a5abd127eb5a452063a24c07c010bd5eacd6d348ee66e301acf4019437495f275
7
- data.tar.gz: 5fe1793c977736d242cbc035593019cd3bab91c4cee2cf0e48400541310554d0a6d7aca08d43890c2d15a2256d18fe96541d75303d48c80f31d4c7b9e775b311
6
+ metadata.gz: bf627a3dfb63ef584e9a257db8f5a0268d66de51a87ba71815f95055d56cb5c4c4abcb437f1b4ac860b18e568e9b790617e93fc35b5aaf9858ed0ab9564c5597
7
+ data.tar.gz: 983f06d6e8fce525da56be1c1e661d6ee15ac348b751e9c86ecb95d180f187e9db5a95d823814cc7a93a116e8959a4c0978fdba94e8e152e7d449bb472e29c4c
data/.idea/logging.iml CHANGED
@@ -7,17 +7,17 @@
7
7
  <content url="file://$MODULE_DIR$" />
8
8
  <orderEntry type="jdk" jdkName="RVM: ruby-2.7.5" jdkType="RUBY_SDK" />
9
9
  <orderEntry type="sourceFolder" forTests="false" />
10
- <orderEntry type="library" scope="PROVIDED" name="actioncable (v7.0.2.3, RVM: ruby-2.7.5) [gem]" level="application" />
11
- <orderEntry type="library" scope="PROVIDED" name="actionmailbox (v7.0.2.3, RVM: ruby-2.7.5) [gem]" level="application" />
12
- <orderEntry type="library" scope="PROVIDED" name="actionmailer (v7.0.2.3, RVM: ruby-2.7.5) [gem]" level="application" />
13
- <orderEntry type="library" scope="PROVIDED" name="actionpack (v7.0.2.3, RVM: ruby-2.7.5) [gem]" level="application" />
14
- <orderEntry type="library" scope="PROVIDED" name="actiontext (v7.0.2.3, RVM: ruby-2.7.5) [gem]" level="application" />
15
- <orderEntry type="library" scope="PROVIDED" name="actionview (v7.0.2.3, RVM: ruby-2.7.5) [gem]" level="application" />
16
- <orderEntry type="library" scope="PROVIDED" name="activejob (v7.0.2.3, RVM: ruby-2.7.5) [gem]" level="application" />
17
- <orderEntry type="library" scope="PROVIDED" name="activemodel (v7.0.2.3, RVM: ruby-2.7.5) [gem]" level="application" />
18
- <orderEntry type="library" scope="PROVIDED" name="activerecord (v7.0.2.3, RVM: ruby-2.7.5) [gem]" level="application" />
19
- <orderEntry type="library" scope="PROVIDED" name="activestorage (v7.0.2.3, RVM: ruby-2.7.5) [gem]" level="application" />
20
- <orderEntry type="library" scope="PROVIDED" name="activesupport (v7.0.2.3, RVM: ruby-2.7.5) [gem]" level="application" />
10
+ <orderEntry type="library" scope="PROVIDED" name="actioncable (v7.0.3, RVM: ruby-2.7.5) [gem]" level="application" />
11
+ <orderEntry type="library" scope="PROVIDED" name="actionmailbox (v7.0.3, RVM: ruby-2.7.5) [gem]" level="application" />
12
+ <orderEntry type="library" scope="PROVIDED" name="actionmailer (v7.0.3, RVM: ruby-2.7.5) [gem]" level="application" />
13
+ <orderEntry type="library" scope="PROVIDED" name="actionpack (v7.0.3, RVM: ruby-2.7.5) [gem]" level="application" />
14
+ <orderEntry type="library" scope="PROVIDED" name="actiontext (v7.0.3, RVM: ruby-2.7.5) [gem]" level="application" />
15
+ <orderEntry type="library" scope="PROVIDED" name="actionview (v7.0.3, RVM: ruby-2.7.5) [gem]" level="application" />
16
+ <orderEntry type="library" scope="PROVIDED" name="activejob (v7.0.3, RVM: ruby-2.7.5) [gem]" level="application" />
17
+ <orderEntry type="library" scope="PROVIDED" name="activemodel (v7.0.3, RVM: ruby-2.7.5) [gem]" level="application" />
18
+ <orderEntry type="library" scope="PROVIDED" name="activerecord (v7.0.3, RVM: ruby-2.7.5) [gem]" level="application" />
19
+ <orderEntry type="library" scope="PROVIDED" name="activestorage (v7.0.3, RVM: ruby-2.7.5) [gem]" level="application" />
20
+ <orderEntry type="library" scope="PROVIDED" name="activesupport (v7.0.3, RVM: ruby-2.7.5) [gem]" level="application" />
21
21
  <orderEntry type="library" scope="PROVIDED" name="amazing_print (v1.4.0, RVM: ruby-2.7.5) [gem]" level="application" />
22
22
  <orderEntry type="library" scope="PROVIDED" name="ansi (v1.5.0, RVM: ruby-2.7.5) [gem]" level="application" />
23
23
  <orderEntry type="library" scope="PROVIDED" name="ast (v2.4.2, RVM: ruby-2.7.5) [gem]" level="application" />
@@ -29,7 +29,7 @@
29
29
  <orderEntry type="library" scope="PROVIDED" name="ci_reporter (v2.0.0, RVM: ruby-2.7.5) [gem]" level="application" />
30
30
  <orderEntry type="library" scope="PROVIDED" name="ci_reporter_rspec (v1.0.0, RVM: ruby-2.7.5) [gem]" level="application" />
31
31
  <orderEntry type="library" scope="PROVIDED" name="colorize (v0.8.1, RVM: ruby-2.7.5) [gem]" level="application" />
32
- <orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.1.9, RVM: ruby-2.7.5) [gem]" level="application" />
32
+ <orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.1.10, RVM: ruby-2.7.5) [gem]" level="application" />
33
33
  <orderEntry type="library" scope="PROVIDED" name="crass (v1.0.6, RVM: ruby-2.7.5) [gem]" level="application" />
34
34
  <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.5.0, RVM: ruby-2.7.5) [gem]" level="application" />
35
35
  <orderEntry type="library" scope="PROVIDED" name="digest (v3.1.0, RVM: ruby-2.7.5) [gem]" level="application" />
@@ -40,11 +40,10 @@
40
40
  <orderEntry type="library" scope="PROVIDED" name="globalid (v1.0.0, RVM: ruby-2.7.5) [gem]" level="application" />
41
41
  <orderEntry type="library" scope="PROVIDED" name="i18n (v1.10.0, RVM: ruby-2.7.5) [gem]" level="application" />
42
42
  <orderEntry type="library" scope="PROVIDED" name="io-console (v0.5.11, RVM: ruby-2.7.5) [gem]" level="application" />
43
- <orderEntry type="library" scope="PROVIDED" name="io-wait (v0.2.1, RVM: ruby-2.7.5) [gem]" level="application" />
44
43
  <orderEntry type="library" scope="PROVIDED" name="irb (v1.4.1, RVM: ruby-2.7.5) [gem]" level="application" />
45
44
  <orderEntry type="library" scope="PROVIDED" name="listen (v3.1.5, RVM: ruby-2.7.5) [gem]" level="application" />
46
- <orderEntry type="library" scope="PROVIDED" name="lograge (v0.11.2, RVM: ruby-2.7.5) [gem]" level="application" />
47
- <orderEntry type="library" scope="PROVIDED" name="loofah (v2.15.0, RVM: ruby-2.7.5) [gem]" level="application" />
45
+ <orderEntry type="library" scope="PROVIDED" name="lograge (v0.12.0, RVM: ruby-2.7.5) [gem]" level="application" />
46
+ <orderEntry type="library" scope="PROVIDED" name="loofah (v2.18.0, RVM: ruby-2.7.5) [gem]" level="application" />
48
47
  <orderEntry type="library" scope="PROVIDED" name="mail (v2.7.1, RVM: ruby-2.7.5) [gem]" level="application" />
49
48
  <orderEntry type="library" scope="PROVIDED" name="marcel (v1.0.2, RVM: ruby-2.7.5) [gem]" level="application" />
50
49
  <orderEntry type="library" scope="PROVIDED" name="method_source (v1.0.0, RVM: ruby-2.7.5) [gem]" level="application" />
@@ -52,49 +51,50 @@
52
51
  <orderEntry type="library" scope="PROVIDED" name="minitest (v5.15.0, RVM: ruby-2.7.5) [gem]" level="application" />
53
52
  <orderEntry type="library" scope="PROVIDED" name="net-imap (v0.2.3, RVM: ruby-2.7.5) [gem]" level="application" />
54
53
  <orderEntry type="library" scope="PROVIDED" name="net-pop (v0.1.1, RVM: ruby-2.7.5) [gem]" level="application" />
55
- <orderEntry type="library" scope="PROVIDED" name="net-protocol (v0.1.2, RVM: ruby-2.7.5) [gem]" level="application" />
54
+ <orderEntry type="library" scope="PROVIDED" name="net-protocol (v0.1.3, RVM: ruby-2.7.5) [gem]" level="application" />
56
55
  <orderEntry type="library" scope="PROVIDED" name="net-smtp (v0.3.1, RVM: ruby-2.7.5) [gem]" level="application" />
57
56
  <orderEntry type="library" scope="PROVIDED" name="nio4r (v2.5.8, RVM: ruby-2.7.5) [gem]" level="application" />
58
- <orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.13.3, RVM: ruby-2.7.5) [gem]" level="application" />
57
+ <orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.13.6, RVM: ruby-2.7.5) [gem]" level="application" />
59
58
  <orderEntry type="library" scope="PROVIDED" name="oj (v3.13.11, RVM: ruby-2.7.5) [gem]" level="application" />
60
59
  <orderEntry type="library" scope="PROVIDED" name="ougai (v1.9.1, RVM: ruby-2.7.5) [gem]" level="application" />
61
- <orderEntry type="library" scope="PROVIDED" name="parallel (v1.21.0, RVM: ruby-2.7.5) [gem]" level="application" />
62
- <orderEntry type="library" scope="PROVIDED" name="parser (v3.1.1.0, RVM: ruby-2.7.5) [gem]" level="application" />
60
+ <orderEntry type="library" scope="PROVIDED" name="parallel (v1.22.1, RVM: ruby-2.7.5) [gem]" level="application" />
61
+ <orderEntry type="library" scope="PROVIDED" name="parser (v3.1.2.0, RVM: ruby-2.7.5) [gem]" level="application" />
63
62
  <orderEntry type="library" scope="PROVIDED" name="racc (v1.6.0, RVM: ruby-2.7.5) [gem]" level="application" />
64
63
  <orderEntry type="library" scope="PROVIDED" name="rack (v2.2.3, RVM: ruby-2.7.5) [gem]" level="application" />
65
64
  <orderEntry type="library" scope="PROVIDED" name="rack-test (v1.1.0, RVM: ruby-2.7.5) [gem]" level="application" />
66
- <orderEntry type="library" scope="PROVIDED" name="rails (v7.0.2.3, RVM: ruby-2.7.5) [gem]" level="application" />
65
+ <orderEntry type="library" scope="PROVIDED" name="rails (v7.0.3, RVM: ruby-2.7.5) [gem]" level="application" />
67
66
  <orderEntry type="library" scope="PROVIDED" name="rails-dom-testing (v2.0.3, RVM: ruby-2.7.5) [gem]" level="application" />
68
67
  <orderEntry type="library" scope="PROVIDED" name="rails-html-sanitizer (v1.4.2, RVM: ruby-2.7.5) [gem]" level="application" />
69
- <orderEntry type="library" scope="PROVIDED" name="railties (v7.0.2.3, RVM: ruby-2.7.5) [gem]" level="application" />
68
+ <orderEntry type="library" scope="PROVIDED" name="railties (v7.0.3, RVM: ruby-2.7.5) [gem]" level="application" />
70
69
  <orderEntry type="library" scope="PROVIDED" name="rainbow (v3.1.1, RVM: ruby-2.7.5) [gem]" level="application" />
71
70
  <orderEntry type="library" scope="PROVIDED" name="rake (v13.0.6, RVM: ruby-2.7.5) [gem]" level="application" />
72
71
  <orderEntry type="library" scope="PROVIDED" name="rb-fsevent (v0.11.1, RVM: ruby-2.7.5) [gem]" level="application" />
73
72
  <orderEntry type="library" scope="PROVIDED" name="rb-inotify (v0.10.1, RVM: ruby-2.7.5) [gem]" level="application" />
74
- <orderEntry type="library" scope="PROVIDED" name="regexp_parser (v2.2.1, RVM: ruby-2.7.5) [gem]" level="application" />
73
+ <orderEntry type="library" scope="PROVIDED" name="regexp_parser (v2.4.0, RVM: ruby-2.7.5) [gem]" level="application" />
75
74
  <orderEntry type="library" scope="PROVIDED" name="reline (v0.3.1, RVM: ruby-2.7.5) [gem]" level="application" />
76
75
  <orderEntry type="library" scope="PROVIDED" name="request_store (v1.5.1, RVM: ruby-2.7.5) [gem]" level="application" />
77
76
  <orderEntry type="library" scope="PROVIDED" name="rexml (v3.2.5, RVM: ruby-2.7.5) [gem]" level="application" />
78
77
  <orderEntry type="library" scope="PROVIDED" name="rspec (v3.11.0, RVM: ruby-2.7.5) [gem]" level="application" />
79
78
  <orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.11.0, RVM: ruby-2.7.5) [gem]" level="application" />
80
79
  <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.11.0, RVM: ruby-2.7.5) [gem]" level="application" />
81
- <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.11.0, RVM: ruby-2.7.5) [gem]" level="application" />
80
+ <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.11.1, RVM: ruby-2.7.5) [gem]" level="application" />
82
81
  <orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.11.0, RVM: ruby-2.7.5) [gem]" level="application" />
83
- <orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.16.0, RVM: ruby-2.7.5) [gem]" level="application" />
82
+ <orderEntry type="library" scope="PROVIDED" name="rubocop (v1.26.1, RVM: ruby-2.7.5) [gem]" level="application" />
83
+ <orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.17.0, RVM: ruby-2.7.5) [gem]" level="application" />
84
84
  <orderEntry type="library" scope="PROVIDED" name="rubocop-rspec (v2.4.0, RVM: ruby-2.7.5) [gem]" level="application" />
85
85
  <orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.11.0, RVM: ruby-2.7.5) [gem]" level="application" />
86
86
  <orderEntry type="library" scope="PROVIDED" name="ruby_dep (v1.5.0, RVM: ruby-2.7.5) [gem]" level="application" />
87
87
  <orderEntry type="library" scope="PROVIDED" name="simplecov (v0.21.2, RVM: ruby-2.7.5) [gem]" level="application" />
88
88
  <orderEntry type="library" scope="PROVIDED" name="simplecov-console (v0.9.1, RVM: ruby-2.7.5) [gem]" level="application" />
89
89
  <orderEntry type="library" scope="PROVIDED" name="simplecov-html (v0.12.3, RVM: ruby-2.7.5) [gem]" level="application" />
90
- <orderEntry type="library" scope="PROVIDED" name="simplecov-rcov (v0.2.3, RVM: ruby-2.7.5) [gem]" level="application" />
90
+ <orderEntry type="library" scope="PROVIDED" name="simplecov-rcov (v0.3.1, RVM: ruby-2.7.5) [gem]" level="application" />
91
91
  <orderEntry type="library" scope="PROVIDED" name="simplecov_json_formatter (v0.1.4, RVM: ruby-2.7.5) [gem]" level="application" />
92
- <orderEntry type="library" scope="PROVIDED" name="strscan (v3.0.1, RVM: ruby-2.7.5) [gem]" level="application" />
92
+ <orderEntry type="library" scope="PROVIDED" name="strscan (v3.0.3, RVM: ruby-2.7.5) [gem]" level="application" />
93
93
  <orderEntry type="library" scope="PROVIDED" name="terminal-table (v3.0.2, RVM: ruby-2.7.5) [gem]" level="application" />
94
94
  <orderEntry type="library" scope="PROVIDED" name="thor (v1.2.1, RVM: ruby-2.7.5) [gem]" level="application" />
95
95
  <orderEntry type="library" scope="PROVIDED" name="timeout (v0.2.0, RVM: ruby-2.7.5) [gem]" level="application" />
96
96
  <orderEntry type="library" scope="PROVIDED" name="tzinfo (v2.0.4, RVM: ruby-2.7.5) [gem]" level="application" />
97
- <orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v1.8.0, RVM: ruby-2.7.5) [gem]" level="application" />
97
+ <orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v2.1.0, RVM: ruby-2.7.5) [gem]" level="application" />
98
98
  <orderEntry type="library" scope="PROVIDED" name="websocket-driver (v0.7.5, RVM: ruby-2.7.5) [gem]" level="application" />
99
99
  <orderEntry type="library" scope="PROVIDED" name="websocket-extensions (v0.1.5, RVM: ruby-2.7.5) [gem]" level="application" />
100
100
  <orderEntry type="library" scope="PROVIDED" name="zeitwerk (v2.5.4, RVM: ruby-2.7.5) [gem]" level="application" />
@@ -105,7 +105,41 @@
105
105
  </component>
106
106
  <component name="RakeTasksCache">
107
107
  <option name="myRootTask">
108
- <RakeTaskImpl id="rake" />
108
+ <RakeTaskImpl id="rake">
109
+ <subtasks>
110
+ <RakeTaskImpl id="bundle">
111
+ <subtasks>
112
+ <RakeTaskImpl description="Check bundled gems for vulnerabilities against the latest ruby-advisory-db" fullCommand="bundle:audit" id="audit" />
113
+ </subtasks>
114
+ </RakeTaskImpl>
115
+ <RakeTaskImpl description="Check test coverage, check code style, check gems for vulnerabilities" fullCommand="check" id="check" />
116
+ <RakeTaskImpl description="Remove artifacts directory, except for .keep file" fullCommand="clean" id="clean" />
117
+ <RakeTaskImpl description="Run all specs in spec directory, with coverage" fullCommand="coverage" id="coverage" />
118
+ <RakeTaskImpl description="Clean, check, build gem" fullCommand="default" id="default" />
119
+ <RakeTaskImpl description="Build berkeley_library-logging.gemspec as berkeley_library-logging-0.2.6.1.gem" fullCommand="gem" id="gem" />
120
+ <RakeTaskImpl description="Run RuboCop" fullCommand="rubocop" id="rubocop" />
121
+ <RakeTaskImpl id="rubocop">
122
+ <subtasks>
123
+ <RakeTaskImpl description="Auto-correct RuboCop offenses" fullCommand="rubocop:auto_correct" id="auto_correct" />
124
+ </subtasks>
125
+ </RakeTaskImpl>
126
+ <RakeTaskImpl description="Run all specs in spec directory" fullCommand="spec" id="spec" />
127
+ <RakeTaskImpl id="spec">
128
+ <subtasks>
129
+ <RakeTaskImpl description="Run specs in spec/rails directory" fullCommand="spec:rails" id="rails" />
130
+ <RakeTaskImpl description="Run specs in spec/standalone directory" fullCommand="spec:standalone" id="standalone" />
131
+ <RakeTaskImpl description="" fullCommand="spec:all" id="all" />
132
+ <RakeTaskImpl description="" fullCommand="spec:prepare" id="prepare" />
133
+ </subtasks>
134
+ </RakeTaskImpl>
135
+ <RakeTaskImpl id="simplecov">
136
+ <subtasks>
137
+ <RakeTaskImpl description="" fullCommand="simplecov:check_coverage" id="check_coverage" />
138
+ <RakeTaskImpl description="" fullCommand="simplecov:report" id="report" />
139
+ </subtasks>
140
+ </RakeTaskImpl>
141
+ </subtasks>
142
+ </RakeTaskImpl>
109
143
  </option>
110
144
  </component>
111
145
  </module>
data/CHANGES.md CHANGED
@@ -1,3 +1,16 @@
1
+ # 0.2.7 (2022-05-25)
2
+
3
+ - Set `BerkeleyLibrary::Logging.logger` on Railtie initialization
4
+
5
+ # 0.2.6.2 (2022-05-25)
6
+
7
+ - Fix `NoMethodError` when calling `BerkeleyLibrary::Logging::Loggers.default_logger` before
8
+ Rails is fully initialized
9
+
10
+ # 0.2.6.1 (2022-05-11)
11
+
12
+ - Fix `LoadError` on Rails 6.x.
13
+
1
14
  # 0.2.6 (2022-03-14)
2
15
 
3
16
  - Add support for Rails 7.
@@ -25,7 +25,9 @@ Gem::Specification.new do |spec|
25
25
 
26
26
  spec.required_ruby_version = ">= #{ruby_version}"
27
27
 
28
- spec.add_dependency 'activesupport', '>= 6.0'
28
+ rails_version = '>= 6'
29
+
30
+ spec.add_dependency 'activesupport', rails_version
29
31
  spec.add_dependency 'amazing_print', '~> 1.1'
30
32
  spec.add_dependency 'colorize', '~> 0.8.1'
31
33
  spec.add_dependency 'lograge', '~> 0.11'
@@ -37,7 +39,7 @@ Gem::Specification.new do |spec|
37
39
  spec.add_development_dependency 'dotenv', '~> 2.7'
38
40
  spec.add_development_dependency 'irb', '~> 1.2' # workaroundfor https://github.com/bundler/bundler/issues/6929
39
41
  spec.add_development_dependency 'listen', '>= 3.0.5', '< 3.2'
40
- spec.add_development_dependency 'rails', '>= 6.0'
42
+ spec.add_development_dependency 'rails', rails_version
41
43
  spec.add_development_dependency 'rake', '~> 13.0'
42
44
  spec.add_development_dependency 'rspec-support', '~> 3.9'
43
45
  spec.add_development_dependency 'rubocop', '~> 1.26.0'
@@ -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
@@ -1,4 +1,11 @@
1
- require 'active_support/isolated_execution_state'
1
+ begin
2
+ # Rails 7.x LoggerThreadSafeLevel needs IsolatedExecutionState,
3
+ # but doesn't explicitly require it
4
+ require 'active_support/isolated_execution_state'
5
+ rescue LoadError
6
+ # Rails 6.x doesn't
7
+ end
8
+
2
9
  require 'active_support/logger'
3
10
  require 'ougai'
4
11
  require 'berkeley_library/logging/tagged_logging_extensions'
@@ -9,13 +9,7 @@ module BerkeleyLibrary
9
9
  FALLBACK_LOG_DIR = 'log'.freeze
10
10
 
11
11
  def default_logger
12
- if defined?(Rails)
13
- return Rails.logger if Rails.logger
14
-
15
- warn('Rails is defined, but Rails logger is nil')
16
- end
17
-
18
- new_default_logger
12
+ rails_logger || new_default_logger
19
13
  end
20
14
 
21
15
  # TODO: support passing a hash / passing default_log_file
@@ -38,6 +32,13 @@ module BerkeleyLibrary
38
32
 
39
33
  private
40
34
 
35
+ def rails_logger
36
+ return unless defined?(Rails)
37
+ return unless Rails.respond_to?(:logger)
38
+
39
+ Rails.logger
40
+ end
41
+
41
42
  def new_broadcast_logger(config)
42
43
  new_json_logger($stdout).tap do |json_logger|
43
44
  file_logger = rails_file_logger(config)
@@ -68,7 +69,7 @@ module BerkeleyLibrary
68
69
  end
69
70
 
70
71
  def workdir
71
- return Rails.application.root if defined?(Rails)
72
+ return Rails.application.root if defined?(Rails) && Rails.respond_to?(:application)
72
73
 
73
74
  Pathname.getwd
74
75
  end
@@ -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'.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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: berkeley_library-logging
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Moles
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-14 00:00:00.000000000 Z
11
+ date: 2022-05-25 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: '6'
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: '6'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: amazing_print
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -176,14 +176,14 @@ dependencies:
176
176
  requirements:
177
177
  - - ">="
178
178
  - !ruby/object:Gem::Version
179
- version: '6.0'
179
+ version: '6'
180
180
  type: :development
181
181
  prerelease: false
182
182
  version_requirements: !ruby/object:Gem::Requirement
183
183
  requirements:
184
184
  - - ">="
185
185
  - !ruby/object:Gem::Version
186
- version: '6.0'
186
+ version: '6'
187
187
  - !ruby/object:Gem::Dependency
188
188
  name: rake
189
189
  requirement: !ruby/object:Gem::Requirement