optional_logger 1.1.0 → 2.0.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: 1fac6b9d6d29180865ac0937c8c39f86c716af25
4
- data.tar.gz: 3f70c78f17966bad92edbe300ec90d27491f5a8b
3
+ metadata.gz: 62568107e4c9f159c14814070e453409e32339f8
4
+ data.tar.gz: 22acaf432e1f2f0334f47193dc5da8b61a759a17
5
5
  SHA512:
6
- metadata.gz: e5ce7f7db093856ecdf3f0c22d61876baff65597cb30310a91e6b75b43febe323a1ba72b60ed604eca08a6f621e133581aeb88c0f3ec09a50e6d7a322b7d1e31
7
- data.tar.gz: 324833b641124a2c9bf694d1a81b7a4230497cbe25e2b6ed54d066954d98ee0f033970c7072277d8ab12dae3dea96c5b535443687df6988e043b25c3dba0c13f
6
+ metadata.gz: c1be9cfb63e6e23c961458ccb3f3f31b5d65887ad2d923c45f020c66d54a7dae9f68731718d5570d4c8354e78b0379cdf11917c6997c89ab3f44cffcffcd6118
7
+ data.tar.gz: f49aa48f270edb72dc4e6ae3bfc9a922627423317da3bdc341990816c049e74bb6f5ea4d90ab81f4bd0bcecae15285dd807c179afa7d02da1c07211fbcee8551
@@ -2,15 +2,23 @@
2
2
 
3
3
  The following are lists of the notable changes included with each release.
4
4
  This is intended to help keep people informed about notable changes between
5
- versions, as well as provide a rough history.
5
+ versions, as well as provide a rough history. Each item is prefixed with
6
+ one of the following labels: `Added`, `Changed`, `Deprecated`,
7
+ `Removed`, `Fixed`, `Security`. We also use [Semantic
8
+ Versioning](http://semver.org) to manage the versions of this gem so
9
+ that you can set version constraints properly.
6
10
 
7
11
  #### Next Release
8
12
 
9
- #### v1.1.0
13
+ #### [v2.0.0] - 2016-10-24
14
+
15
+ * Changed logger management to work at class or instance level
16
+
17
+ #### [v1.1.0] - 2016-10-18
10
18
 
11
19
  * Added logger management module
12
20
 
13
- #### v1.0.0
21
+ #### [v1.0.0] - 2016-10-11
14
22
 
15
23
  * Added documentation around all the classes, modules, constants and methods
16
24
  * Added OptionalLogger::Logger level introspection methods (#debug?, #info?,
@@ -20,3 +28,8 @@ versions, as well as provide a rough history.
20
28
  * Added OptionalLogger::Logger#add and #log methods
21
29
  * Added OptionalLogger::Logger class and constructor
22
30
  * Added OptionalLogger module skeleton
31
+
32
+ [Unreleased]: https://github.com/Acornsgrow/optional_logger/compare/v2.0.0...HEAD
33
+ [v2.0.0]: https://github.com/Acornsgrow/optional_logger/compare/v1.1.0...v2.0.0
34
+ [v1.1.0]: https://github.com/Acornsgrow/optional_logger/compare/v1.0.0...v1.1.0
35
+ [v1.0.0]: https://github.com/Acornsgrow/optional_logger/compare/d377eb0...v1.0.0
data/README.md CHANGED
@@ -36,7 +36,7 @@ accidentally altering the applications logger.
36
36
  Add this line to your gem's gemspec file:
37
37
 
38
38
  ```ruby
39
- spec.add_dependency 'optional_logger', '~> 1.1'
39
+ spec.add_dependency 'optional_logger', '~> 2.0'
40
40
  ```
41
41
 
42
42
  Or install it yourself as:
@@ -95,14 +95,18 @@ logger as it is managed by the application that is using your library.
95
95
 
96
96
  We also provide a small module to aid with logger management within your gem if
97
97
  you don't want to write your own logger management using the core logger
98
- provided above. The following is an example of how might use it if you had a gem
99
- called `my_foo_gem`.
98
+ provided above. The following are a couple examples of how you might use it.
99
+
100
+ #### Module/Class Level
101
+
102
+ If you want to provide the logger interface at a Module/Class level. You would
103
+ do the following.
100
104
 
101
105
  ```ruby
102
106
  require 'optional_logger'
103
107
 
104
108
  module MyFooGem
105
- include OptionalLogger::LoggerManagement
109
+ extend OptionalLogger::LoggerManagement
106
110
  end
107
111
  ```
108
112
 
@@ -117,6 +121,41 @@ the application logger they provided within your gem as follows.
117
121
 
118
122
  ```ruby
119
123
  MyFooGem.logger # => the optional logger wrapping some_application_logger
124
+
125
+ # or if you are inside the module
126
+
127
+ self.logger # or simply logger
128
+ ```
129
+
130
+ #### Instance Level
131
+
132
+ If you want to provide the logger interface at an instance level. You would do
133
+ the following.
134
+
135
+ ```ruby
136
+ require 'optional_logger'
137
+
138
+ module MyClass
139
+ include OptionalLogger::LoggerManagement
140
+ end
141
+ ```
142
+
143
+ The above would enable consumers of your library to set the logger as follows.
144
+
145
+ ```ruby
146
+ obj = MyClass.new
147
+ obj.logger(some_application_logger)
148
+ ```
149
+
150
+ It also enables you to access an `OptionalLogger::Logger` instance that wraps
151
+ the application logger they provided within your gem as follows.
152
+
153
+ ```ruby
154
+ obj.logger # => the optional logger wrapping some_application_logger
155
+
156
+ # or if you are inside the class
157
+
158
+ self.logger # or simply logger
120
159
  ```
121
160
 
122
161
  ## Development
@@ -2,15 +2,9 @@ require 'optional_logger'
2
2
 
3
3
  module OptionalLogger
4
4
  module LoggerManagement
5
- def self.included(base)
6
- base.extend(ClassMethods)
7
- end
8
-
9
- module ClassMethods
10
- def logger(logger = nil)
11
- return @logger if @logger && logger.nil?
12
- @logger = OptionalLogger::Logger.new(logger)
13
- end
5
+ def logger(logger = nil)
6
+ return @logger if @logger && logger.nil?
7
+ @logger = OptionalLogger::Logger.new(logger)
14
8
  end
15
9
  end
16
10
  end
@@ -1,4 +1,4 @@
1
1
  module OptionalLogger
2
2
  # The version of the library
3
- VERSION = "1.1.0"
3
+ VERSION = "2.0.0"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: optional_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew De Ponte
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-19 00:00:00.000000000 Z
11
+ date: 2016-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler