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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 1fac6b9d6d29180865ac0937c8c39f86c716af25
4
- data.tar.gz: 3f70c78f17966bad92edbe300ec90d27491f5a8b
2
+ SHA256:
3
+ metadata.gz: 70264edb7234d677c984a9ced39cc95eede2375bd912a2103921f3f77aa68baf
4
+ data.tar.gz: 3b5ebe069df89f3342aff5d800decd9f2ee95d7a342fc0bdc1bebec714294514
5
5
  SHA512:
6
- metadata.gz: e5ce7f7db093856ecdf3f0c22d61876baff65597cb30310a91e6b75b43febe323a1ba72b60ed604eca08a6f621e133581aeb88c0f3ec09a50e6d7a322b7d1e31
7
- data.tar.gz: 324833b641124a2c9bf694d1a81b7a4230497cbe25e2b6ed54d066954d98ee0f033970c7072277d8ab12dae3dea96c5b535443687df6988e043b25c3dba0c13f
6
+ metadata.gz: 654c1d134b2adf2f8888176d424c7d5383869b99184dbe71a11909e67907a21e5b717bcc4dc94cff7f4585300a2b9f816603371a3ea18d1c993cb8a69be40cff
7
+ data.tar.gz: 562e509789c3cb4e87125b92af7593846e6df4acefe946509f2c59d97a2d91b02e2182b200859ba932b385a1d6379e1d79928b54e0061738656fb7978661aea6
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.3.3
data/.travis.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.3.1
5
- before_install: gem install bundler -v 1.13.2
4
+ - 3.3.3
5
+ before_install: gem install bundler -v 2.5.11
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
- #### 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/Gemfile CHANGED
@@ -1,6 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem "codeclimate-test-reporter", group: :test, require: nil
4
-
5
3
  # Specify your gem's dependencies in optional_logger.gemspec
6
4
  gemspec
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', '~> 1.1'
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 is an example of how might use it if you had a gem
99
- called `my_foo_gem`.
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
- include OptionalLogger::LoggerManagement
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 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.1.0"
4
4
  end
@@ -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/Acornsgrow/optional_logger"
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", "~> 1.13"
25
- spec.add_development_dependency "rake", "~> 10.0"
26
- spec.add_development_dependency "rspec", "~> 3.0"
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: 1.1.0
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: 2016-10-19 00:00:00.000000000 Z
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: '1.13'
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: '1.13'
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: '10.0'
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: '10.0'
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.0'
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.0'
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/Acornsgrow/optional_logger
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
- rubyforge_project:
99
- rubygems_version: 2.5.1
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: []
data/.codeclimate.yml DELETED
@@ -1,9 +0,0 @@
1
- ---
2
- engines:
3
- fixme:
4
- enabled: true
5
- rubcop:
6
- enabled: true
7
- ratings:
8
- paths:
9
- - "lib/**/*"