cute_logger 0.1.8 → 0.1.9

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
  SHA1:
3
- metadata.gz: e2a41c1667b2570dbb80e6f63a74ee935bdda450
4
- data.tar.gz: 4e355eda70cc238f69800ff3e8bb852798968ce9
3
+ metadata.gz: 8d3523a219c949dde0b71ad25bfa5d9829f301ad
4
+ data.tar.gz: 069937c907681020fd52a82b09b3ff9556b15523
5
5
  SHA512:
6
- metadata.gz: 8d7a4a558e8e305d446113d020283d042eef00e8d8026feb266e096f6a625153130eb14a5ed4b2f4f41fd9f7f0af0b83224948e4d75b351e8de3feb2997f032f
7
- data.tar.gz: f66a9cb74e69cef2c326de709c237b65ecc86c3f69202993cc4bcd68b0296f463a1312d873fc037cc5fe6eeb77cb145aa3cec787d42c9c1e3913f2c47639d310
6
+ metadata.gz: ac824f1b4edc95bd93f350c26cd9318d0aa10160ea98e6522b4e641412ed80a701a758f2b3aebfbf5852d8c5086048977c851cebd0092a1a1bc4259f58e37705
7
+ data.tar.gz: 7472207728297a4a79ccbddaf42e471f71ef4f94e9fe893eb2485e8d8cc31211b8006939ea83b96703f6e155f9616f1135795d942eccfa001d5df39b4f945a98
data/README.md CHANGED
@@ -152,6 +152,19 @@ $ grep "ERROR" application.log | grep "ID000233" | cute_log
152
152
  $ grep "WARN" application.log | grep "2017-01" | cute_log
153
153
  ```
154
154
 
155
+ ### Using environment variables
156
+
157
+ It is possible to configure the logging settings via environment variables. For example:
158
+
159
+ ```bash
160
+ export CUTE_LOGGER_FILENAME=archive.log
161
+ export CUTE_LOGGER_SHIFT_AGE=7
162
+ export CUTE_LOGGER_SHIFT_SIZE=1000000
163
+ export CUTE_LOGGER_SEVERITY=DEBUG
164
+ ```
165
+
166
+ This is the recommended way to configuring the logger settings.
167
+
155
168
  ## Development
156
169
 
157
170
  Run `rake test` to run the tests.
@@ -16,11 +16,11 @@ module CuteLogger
16
16
 
17
17
  def self.setup(settings = {})
18
18
  @logger = Logger.new(
19
- settings[:filename] || 'application.log',
20
- settings[:shift_age] || 7,
21
- settings[:shift_size] || 1024 * 1024 * 1024 # One gigabyte
19
+ ENV['CUTE_LOGGER_FILENAME'] || settings[:filename] || 'application.log',
20
+ ENV['CUTE_LOGGER_SHIFT_AGE'] || settings[:shift_age] || 7,
21
+ ENV['CUTE_LOGGER_SHIFT_SIZE'] || settings[:shift_size] || 1024 * 1024 * 1024 # One gigabyte
22
22
  )
23
- @logger.sev_threshold = severity(settings[:severity])
23
+ @logger.sev_threshold = severity(ENV['CUTE_LOGGER_SEVERITY'] || settings[:severity])
24
24
  @logger.datetime_format = '%Y-%m-%d %H:%M:%S'
25
25
  @logger.formatter = proc do |severity, datetime, progname, msg|
26
26
  "#{datetime},#{severity},#{Process.pid.to_s(16)},#{Thread.current.object_id.to_s(16)}" \
@@ -1,5 +1,5 @@
1
1
 
2
2
  # Partial module to define the version of the gem
3
3
  module CuteLogger
4
- VERSION = '0.1.8'
4
+ VERSION = '0.1.9'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cute_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jorge Del Rio