optional_logger 1.1.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.ruby-version +1 -0
- data/.travis.yml +2 -2
- data/CHANGELOG.md +16 -3
- data/Gemfile +0 -2
- data/README.md +43 -10
- data/lib/optional_logger/logger_management.rb +3 -9
- data/lib/optional_logger/version.rb +1 -1
- data/optional_logger.gemspec +4 -4
- metadata +14 -15
- data/.codeclimate.yml +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 70264edb7234d677c984a9ced39cc95eede2375bd912a2103921f3f77aa68baf
|
4
|
+
data.tar.gz: 3b5ebe069df89f3342aff5d800decd9f2ee95d7a342fc0bdc1bebec714294514
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 654c1d134b2adf2f8888176d424c7d5383869b99184dbe71a11909e67907a21e5b717bcc4dc94cff7f4585300a2b9f816603371a3ea18d1c993cb8a69be40cff
|
7
|
+
data.tar.gz: 562e509789c3cb4e87125b92af7593846e6df4acefe946509f2c59d97a2d91b02e2182b200859ba932b385a1d6379e1d79928b54e0061738656fb7978661aea6
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.3.3
|
data/.travis.yml
CHANGED
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/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,9 +1,3 @@
|
|
1
|
-
[![Build Status](https://travis-ci.org/Acornsgrow/optional_logger.svg?branch=master)](https://travis-ci.org/Acornsgrow/optional_logger)
|
2
|
-
[![Code Climate](https://codeclimate.com/github/Acornsgrow/optional_logger/badges/gpa.svg)](https://codeclimate.com/github/Acornsgrow/optional_logger)
|
3
|
-
[![Test Coverage](https://codeclimate.com/github/Acornsgrow/optional_logger/badges/coverage.svg)](https://codeclimate.com/github/Acornsgrow/optional_logger/coverage)
|
4
|
-
[![Issue Count](https://codeclimate.com/github/Acornsgrow/optional_logger/badges/issue_count.svg)](https://codeclimate.com/github/Acornsgrow/optional_logger)
|
5
|
-
[![Inline docs](http://inch-ci.org/github/Acornsgrow/optional_logger.svg?branch=master)](http://inch-ci.org/github/Acornsgrow/optional_logger)
|
6
|
-
|
7
1
|
# OptionalLogger
|
8
2
|
|
9
3
|
Easily support application loggers in your gems.
|
@@ -36,7 +30,7 @@ accidentally altering the applications logger.
|
|
36
30
|
Add this line to your gem's gemspec file:
|
37
31
|
|
38
32
|
```ruby
|
39
|
-
spec.add_dependency 'optional_logger', '~>
|
33
|
+
spec.add_dependency 'optional_logger', '~> 2.0'
|
40
34
|
```
|
41
35
|
|
42
36
|
Or install it yourself as:
|
@@ -95,14 +89,18 @@ logger as it is managed by the application that is using your library.
|
|
95
89
|
|
96
90
|
We also provide a small module to aid with logger management within your gem if
|
97
91
|
you don't want to write your own logger management using the core logger
|
98
|
-
provided above. The following
|
99
|
-
|
92
|
+
provided above. The following are a couple examples of how you might use it.
|
93
|
+
|
94
|
+
#### Module/Class Level
|
95
|
+
|
96
|
+
If you want to provide the logger interface at a Module/Class level. You would
|
97
|
+
do the following.
|
100
98
|
|
101
99
|
```ruby
|
102
100
|
require 'optional_logger'
|
103
101
|
|
104
102
|
module MyFooGem
|
105
|
-
|
103
|
+
extend OptionalLogger::LoggerManagement
|
106
104
|
end
|
107
105
|
```
|
108
106
|
|
@@ -117,6 +115,41 @@ the application logger they provided within your gem as follows.
|
|
117
115
|
|
118
116
|
```ruby
|
119
117
|
MyFooGem.logger # => the optional logger wrapping some_application_logger
|
118
|
+
|
119
|
+
# or if you are inside the module
|
120
|
+
|
121
|
+
self.logger # or simply logger
|
122
|
+
```
|
123
|
+
|
124
|
+
#### Instance Level
|
125
|
+
|
126
|
+
If you want to provide the logger interface at an instance level. You would do
|
127
|
+
the following.
|
128
|
+
|
129
|
+
```ruby
|
130
|
+
require 'optional_logger'
|
131
|
+
|
132
|
+
module MyClass
|
133
|
+
include OptionalLogger::LoggerManagement
|
134
|
+
end
|
135
|
+
```
|
136
|
+
|
137
|
+
The above would enable consumers of your library to set the logger as follows.
|
138
|
+
|
139
|
+
```ruby
|
140
|
+
obj = MyClass.new
|
141
|
+
obj.logger(some_application_logger)
|
142
|
+
```
|
143
|
+
|
144
|
+
It also enables you to access an `OptionalLogger::Logger` instance that wraps
|
145
|
+
the application logger they provided within your gem as follows.
|
146
|
+
|
147
|
+
```ruby
|
148
|
+
obj.logger # => the optional logger wrapping some_application_logger
|
149
|
+
|
150
|
+
# or if you are inside the class
|
151
|
+
|
152
|
+
self.logger # or simply logger
|
120
153
|
```
|
121
154
|
|
122
155
|
## 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
|
data/optional_logger.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
|
12
12
|
spec.summary = %q{Logger proxy to handle optionality of presence of a logger}
|
13
13
|
spec.description = %q{Logger proxy to handle optionality of presence of a logger}
|
14
|
-
spec.homepage = "http://github.com/
|
14
|
+
spec.homepage = "http://github.com/drewdeponte/optional_logger"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
22
|
spec.require_paths = ["lib"]
|
23
23
|
|
24
|
-
spec.add_development_dependency "bundler", "~>
|
25
|
-
spec.add_development_dependency "rake", "~>
|
26
|
-
spec.add_development_dependency "rspec", "~> 3.
|
24
|
+
spec.add_development_dependency "bundler", "~> 2.5"
|
25
|
+
spec.add_development_dependency "rake", "~> 13.2"
|
26
|
+
spec.add_development_dependency "rspec", "~> 3.13"
|
27
27
|
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.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew De Ponte
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,42 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.5'
|
20
20
|
type: :development
|
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: '
|
26
|
+
version: '2.5'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '13.2'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '13.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3.
|
47
|
+
version: '3.13'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '3.
|
54
|
+
version: '3.13'
|
55
55
|
description: Logger proxy to handle optionality of presence of a logger
|
56
56
|
email:
|
57
57
|
- cyphactor@gmail.com
|
@@ -59,9 +59,9 @@ executables: []
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
-
- ".codeclimate.yml"
|
63
62
|
- ".gitignore"
|
64
63
|
- ".rspec"
|
64
|
+
- ".ruby-version"
|
65
65
|
- ".travis.yml"
|
66
66
|
- CHANGELOG.md
|
67
67
|
- CODE_OF_CONDUCT.md
|
@@ -76,11 +76,11 @@ files:
|
|
76
76
|
- lib/optional_logger/logger_management.rb
|
77
77
|
- lib/optional_logger/version.rb
|
78
78
|
- optional_logger.gemspec
|
79
|
-
homepage: http://github.com/
|
79
|
+
homepage: http://github.com/drewdeponte/optional_logger
|
80
80
|
licenses:
|
81
81
|
- MIT
|
82
82
|
metadata: {}
|
83
|
-
post_install_message:
|
83
|
+
post_install_message:
|
84
84
|
rdoc_options: []
|
85
85
|
require_paths:
|
86
86
|
- lib
|
@@ -95,9 +95,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
requirements: []
|
98
|
-
|
99
|
-
|
100
|
-
signing_key:
|
98
|
+
rubygems_version: 3.5.14
|
99
|
+
signing_key:
|
101
100
|
specification_version: 4
|
102
101
|
summary: Logger proxy to handle optionality of presence of a logger
|
103
102
|
test_files: []
|