optional_logger 1.1.0 → 2.0.0
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 +4 -4
- data/CHANGELOG.md +16 -3
- data/README.md +43 -4
- data/lib/optional_logger/logger_management.rb +3 -9
- data/lib/optional_logger/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62568107e4c9f159c14814070e453409e32339f8
|
4
|
+
data.tar.gz: 22acaf432e1f2f0334f47193dc5da8b61a759a17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1be9cfb63e6e23c961458ccb3f3f31b5d65887ad2d923c45f020c66d54a7dae9f68731718d5570d4c8354e78b0379cdf11917c6997c89ab3f44cffcffcd6118
|
7
|
+
data.tar.gz: f49aa48f270edb72dc4e6ae3bfc9a922627423317da3bdc341990816c049e74bb6f5ea4d90ab81f4bd0bcecae15285dd807c179afa7d02da1c07211fbcee8551
|
data/CHANGELOG.md
CHANGED
@@ -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
|
-
####
|
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', '~>
|
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
|
99
|
-
|
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
|
-
|
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
|
6
|
-
|
7
|
-
|
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
|
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:
|
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-
|
11
|
+
date: 2016-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|