easy_logging 0.3.0 → 0.4.0

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: b037526760133fc13b0acb182b872a760ef3eb47
4
- data.tar.gz: 11ceca27d8bef25e0801bf47c984e6a868cbd514
3
+ metadata.gz: 3d074856e9f129002465f92d75453d87eef31bf1
4
+ data.tar.gz: feaecfb811f7b37263aa45eabad3157e8f8d9962
5
5
  SHA512:
6
- metadata.gz: 5e1759eef678a446a867585c929eabc85e99a742263ad29a190d1fb6acbcb0eaf74f198d68424530a7f11aa2912e508adb13f082378e6dd66e7f925445dce2fb
7
- data.tar.gz: e283230e578c06c8bf98a1ade97c67c25c23968077543ce5904060b667d49b23c68d49158661bac7e521f094eaa83f7ae309fe98286876f8298a641ecda51f4e
6
+ metadata.gz: 8d69cfe2ae79eadb199ad4e34f0cd7ac08de4c20d76f9369147575c9e103859f7aae6e6daec392cc30b74e48d2fea59b4f91bb6e76e2aed206b543906cb63cee
7
+ data.tar.gz: 840343a88cc3262deb1631fad7a6d0b5c65fd34e7e416b935a96d64a16828487576f83787722543ce9a16b0ad15708abe7540f6bc4b3174011bba6e51e2cbc90
data/README.md CHANGED
@@ -12,7 +12,7 @@
12
12
  - Adds logging functionality anywhere with one, short, descriptive command
13
13
  - Logger works in both class and instance methods
14
14
  - Logger is specific to class and contains class name
15
- - Logger is configurable to use standard streams or file
15
+ - Logger is configurable (destination, level, formatter)
16
16
 
17
17
  ## Installation
18
18
 
@@ -19,6 +19,9 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ["lib"]
21
21
 
22
+ # Usage of prepend
23
+ spec.required_ruby_version = '>= 2.0.0'
24
+
22
25
  spec.add_development_dependency "bundler", "~> 1.14"
23
26
  spec.add_development_dependency "rake", "~> 10.0"
24
27
  spec.add_development_dependency "rspec", "~> 3.0"
@@ -4,10 +4,12 @@ require_relative "easy_logging/version"
4
4
 
5
5
  module EasyLogging
6
6
 
7
- def initialize
8
- super
7
+ module Initializer
9
8
  # Initialize instance level logger at the time of instance creation
10
- logger
9
+ def initialize(*params)
10
+ super
11
+ logger
12
+ end
11
13
  end
12
14
 
13
15
  class << self; attr_accessor :log_destination, :level, :formatter; end
@@ -16,10 +18,6 @@ module EasyLogging
16
18
  @level = Logger::INFO
17
19
  @loggers = {}
18
20
 
19
- def logger
20
- @logger ||= EasyLogging.logger_for(self.class.name)
21
- end
22
-
23
21
  def self.log_destination=(dest)
24
22
  @log_destination = dest
25
23
  end
@@ -28,16 +26,21 @@ module EasyLogging
28
26
  @level = level
29
27
  end
30
28
 
31
- private
29
+ private_class_method
32
30
 
33
31
  # Executed when the module is included. See: https://stackoverflow.com/a/5160822/2771889
34
32
  def self.included(base)
35
- # Class level logger method for includer class (base)
36
- def base.logger
37
- @logger ||= EasyLogging.logger_for(self)
33
+ base.send :prepend, Initializer
34
+ # Class level private logger method for includer class (base)
35
+ class << base
36
+ private
37
+ def logger
38
+ @logger ||= EasyLogging.logger_for(self)
39
+ end
38
40
  end
41
+
39
42
  # Initialize class level logger at the time of including
40
- base.logger
43
+ base.send (:logger)
41
44
  end
42
45
 
43
46
  # Global, memoized, lazy initialized instance of a logger
@@ -53,4 +56,10 @@ private
53
56
  logger
54
57
  end
55
58
 
59
+ private
60
+
61
+ def logger
62
+ @logger ||= EasyLogging.logger_for(self.class.name)
63
+ end
64
+
56
65
  end
@@ -1,3 +1,3 @@
1
1
  module EasyLogging
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy_logging
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - thisismydesign
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-08-19 00:00:00.000000000 Z
11
+ date: 2017-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -139,7 +139,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
139
139
  requirements:
140
140
  - - ">="
141
141
  - !ruby/object:Gem::Version
142
- version: '0'
142
+ version: 2.0.0
143
143
  required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  requirements:
145
145
  - - ">="