null-logger 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 12aa68d2aa6b6b2c79950b32fc593681301fc659
4
+ data.tar.gz: 1bce0e17e16f5d6e7dfbea5600f8bee727782416
5
+ SHA512:
6
+ metadata.gz: 136a9f94774ac910bed66f4c9f3f8dc95a7e52c71af445045dc7850290751b5ce455ed47932d98da94b0d3a0704fd07446f11fb5120b7d1a1c4438d356d02ef1
7
+ data.tar.gz: c92995acfdc4de179b9bb3b33c65b26fed7e7d2971b86580e5502eceaf43f427a1255a76d55699ca0b647b651b4fd1b5b5c17d487ee98fa67db3259bef94fbfe
@@ -0,0 +1,68 @@
1
+ # bundler state
2
+ /.bundle
3
+ /vendor/bundle/
4
+ /vendor/ruby/
5
+ /ruby/
6
+ app.god
7
+
8
+ # minimal Rails specific artifacts
9
+ db/*.sqlite3
10
+ /log/development.log
11
+ /log/production.log
12
+ /log/test.log
13
+ /tmp/*
14
+ *.gem
15
+ *.~
16
+
17
+ # various artifacts
18
+ **.war
19
+ *.rbc
20
+ *.sassc
21
+ .rspec
22
+ .redcar/
23
+ .capistrano/
24
+ .sass-cache
25
+ /config/god/sidekiq.rb
26
+ /config/puma.rb
27
+ /coverage.data
28
+ /coverage/
29
+ /doc/api/
30
+ /doc/app/
31
+ /doc/yard
32
+ /doc/features.html
33
+ /doc/specs.html
34
+ /spec/tmp/*
35
+ /cache
36
+ /capybara*
37
+ /capybara-*.html
38
+ /gems
39
+ /specifications
40
+ rerun.txt
41
+ pickle-email-*.html
42
+
43
+ # If you find yourself ignoring temporary files generated by your text editor
44
+ # or operating system, you probably want to add a global ignore instead:
45
+ # git config --global core.excludesfile ~/.gitignore_global
46
+ #
47
+ # Here are some files you may want to ignore globally:
48
+
49
+ # scm revert files
50
+ **.orig
51
+
52
+ # Mac finder artifacts
53
+ .DS_Store
54
+
55
+ # Netbeans project directory
56
+ /nbproject
57
+
58
+ # RubyMine project files
59
+ .idea
60
+
61
+ # Textmate project files
62
+ /*.tmproj
63
+
64
+ # vim artifacts
65
+ **.swp
66
+
67
+ # documentation
68
+ .yardoc
@@ -0,0 +1 @@
1
+ null-logger
@@ -0,0 +1 @@
1
+ 2.2.3
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.7
4
+ - 2.2.3
5
+ script:
6
+ - bundle exec rake
@@ -0,0 +1,5 @@
1
+ # Null-Logger changelog
2
+
3
+ ## 0.1.0
4
+
5
+ - Initial released version
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development, :test do
6
+ gem 'polishgeeks-dev-tools'
7
+ end
8
+
@@ -0,0 +1,201 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ null-logger (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ abstract_type (0.0.7)
10
+ activemodel (4.2.4)
11
+ activesupport (= 4.2.4)
12
+ builder (~> 3.1)
13
+ activesupport (4.2.4)
14
+ i18n (~> 0.7)
15
+ json (~> 1.7, >= 1.7.7)
16
+ minitest (~> 5.1)
17
+ thread_safe (~> 0.3, >= 0.3.4)
18
+ tzinfo (~> 1.1)
19
+ adamantium (0.2.0)
20
+ ice_nine (~> 0.11.0)
21
+ memoizable (~> 0.4.0)
22
+ ast (2.1.0)
23
+ astrolabe (1.3.1)
24
+ parser (~> 2.2)
25
+ axiom-types (0.1.1)
26
+ descendants_tracker (~> 0.0.4)
27
+ ice_nine (~> 0.11.0)
28
+ thread_safe (~> 0.3, >= 0.3.1)
29
+ brakeman (3.1.0)
30
+ erubis (~> 2.6)
31
+ fastercsv (~> 1.5)
32
+ haml (>= 3.0, < 5.0)
33
+ highline (~> 1.6)
34
+ multi_json (~> 1.2)
35
+ ruby2ruby (>= 2.1.1, < 2.3.0)
36
+ ruby_parser (~> 3.7.0)
37
+ sass (~> 3.0)
38
+ slim (>= 1.3.6, < 4.0)
39
+ terminal-table (~> 1.4.5)
40
+ bson (3.2.3)
41
+ builder (3.2.2)
42
+ coderay (1.1.0)
43
+ coercible (1.0.0)
44
+ descendants_tracker (~> 0.0.1)
45
+ concord (0.1.5)
46
+ adamantium (~> 0.2.0)
47
+ equalizer (~> 0.0.9)
48
+ connection_pool (2.2.0)
49
+ descendants_tracker (0.0.4)
50
+ thread_safe (~> 0.3, >= 0.3.1)
51
+ diff-lcs (1.2.5)
52
+ docile (1.1.5)
53
+ equalizer (0.0.11)
54
+ erubis (2.7.0)
55
+ faker (1.5.0)
56
+ i18n (~> 0.5)
57
+ fastercsv (1.5.5)
58
+ flay (2.4.0)
59
+ ruby_parser (~> 3.0)
60
+ sexp_processor (~> 4.0)
61
+ flog (4.2.1)
62
+ ruby_parser (~> 3.1, > 3.1.0)
63
+ sexp_processor (~> 4.4)
64
+ haml (4.0.7)
65
+ tilt
66
+ haml-lint (0.13.0)
67
+ haml (~> 4.0)
68
+ rubocop (>= 0.25.0)
69
+ sysexits (~> 1.1)
70
+ highline (1.7.3)
71
+ i18n (0.7.0)
72
+ ice_nine (0.11.1)
73
+ json (1.8.3)
74
+ memoizable (0.4.2)
75
+ thread_safe (~> 0.3, >= 0.3.1)
76
+ method_source (0.8.2)
77
+ minitest (5.8.0)
78
+ mongoid (4.0.2)
79
+ activemodel (~> 4.0)
80
+ moped (~> 2.0.0)
81
+ origin (~> 2.1)
82
+ tzinfo (>= 0.3.37)
83
+ mongoid-rspec (2.2.0)
84
+ mongoid (~> 4.0.0)
85
+ rake
86
+ rspec (~> 3.1)
87
+ moped (2.0.7)
88
+ bson (~> 3.0)
89
+ connection_pool (~> 2.0)
90
+ optionable (~> 0.2.0)
91
+ multi_json (1.11.2)
92
+ optionable (0.2.0)
93
+ origin (2.1.1)
94
+ parser (2.2.2.6)
95
+ ast (>= 1.1, < 3.0)
96
+ polishgeeks-dev-tools (1.1.2)
97
+ brakeman
98
+ faker
99
+ haml-lint
100
+ mongoid-rspec
101
+ pry
102
+ rspec
103
+ rubocop
104
+ rubycritic (= 1.2.1)
105
+ shoulda
106
+ simplecov
107
+ timecop
108
+ yard
109
+ powerpack (0.1.1)
110
+ procto (0.0.2)
111
+ pry (0.10.1)
112
+ coderay (~> 1.1.0)
113
+ method_source (~> 0.8.1)
114
+ slop (~> 3.4)
115
+ rainbow (2.0.0)
116
+ rake (10.4.2)
117
+ reek (1.6.3)
118
+ parser (~> 2.2.0.pre.7)
119
+ rainbow (>= 1.99, < 3.0)
120
+ unparser (~> 0.2.2)
121
+ rspec (3.3.0)
122
+ rspec-core (~> 3.3.0)
123
+ rspec-expectations (~> 3.3.0)
124
+ rspec-mocks (~> 3.3.0)
125
+ rspec-core (3.3.2)
126
+ rspec-support (~> 3.3.0)
127
+ rspec-expectations (3.3.1)
128
+ diff-lcs (>= 1.2.0, < 2.0)
129
+ rspec-support (~> 3.3.0)
130
+ rspec-mocks (3.3.2)
131
+ diff-lcs (>= 1.2.0, < 2.0)
132
+ rspec-support (~> 3.3.0)
133
+ rspec-support (3.3.0)
134
+ rubocop (0.33.0)
135
+ astrolabe (~> 1.3)
136
+ parser (>= 2.2.2.5, < 3.0)
137
+ powerpack (~> 0.1)
138
+ rainbow (>= 1.99.1, < 3.0)
139
+ ruby-progressbar (~> 1.4)
140
+ ruby-progressbar (1.7.5)
141
+ ruby2ruby (2.2.0)
142
+ ruby_parser (~> 3.1)
143
+ sexp_processor (~> 4.0)
144
+ ruby_parser (3.7.1)
145
+ sexp_processor (~> 4.1)
146
+ rubycritic (1.2.1)
147
+ flay (= 2.4.0)
148
+ flog (= 4.2.1)
149
+ parser (>= 2.2.0, < 3.0)
150
+ reek (= 1.6.3)
151
+ ruby2ruby (>= 2.1.1, < 3.0)
152
+ virtus (~> 1.0)
153
+ sass (3.4.18)
154
+ sexp_processor (4.6.0)
155
+ shoulda (3.5.0)
156
+ shoulda-context (~> 1.0, >= 1.0.1)
157
+ shoulda-matchers (>= 1.4.1, < 3.0)
158
+ shoulda-context (1.2.1)
159
+ shoulda-matchers (2.8.0)
160
+ activesupport (>= 3.0.0)
161
+ simplecov (0.10.0)
162
+ docile (~> 1.1.0)
163
+ json (~> 1.8)
164
+ simplecov-html (~> 0.10.0)
165
+ simplecov-html (0.10.0)
166
+ slim (3.0.6)
167
+ temple (~> 0.7.3)
168
+ tilt (>= 1.3.3, < 2.1)
169
+ slop (3.6.0)
170
+ sysexits (1.2.0)
171
+ temple (0.7.6)
172
+ terminal-table (1.4.5)
173
+ thread_safe (0.3.5)
174
+ tilt (2.0.1)
175
+ timecop (0.8.0)
176
+ tzinfo (1.2.2)
177
+ thread_safe (~> 0.1)
178
+ unparser (0.2.4)
179
+ abstract_type (~> 0.0.7)
180
+ adamantium (~> 0.2.0)
181
+ concord (~> 0.1.5)
182
+ diff-lcs (~> 1.2.5)
183
+ equalizer (~> 0.0.9)
184
+ parser (~> 2.2.2)
185
+ procto (~> 0.0.2)
186
+ virtus (1.0.5)
187
+ axiom-types (~> 0.1)
188
+ coercible (~> 1.0)
189
+ descendants_tracker (~> 0.0, >= 0.0.3)
190
+ equalizer (~> 0.0, >= 0.0.9)
191
+ yard (0.8.7.6)
192
+
193
+ PLATFORMS
194
+ ruby
195
+
196
+ DEPENDENCIES
197
+ null-logger!
198
+ polishgeeks-dev-tools
199
+
200
+ BUNDLED WITH
201
+ 1.10.6
@@ -0,0 +1,18 @@
1
+ Permission is hereby granted, free of charge, to any person obtaining
2
+ a copy of this software and associated documentation files (the
3
+ "Software"), to deal in the Software without restriction, including
4
+ without limitation the rights to use, copy, modify, merge, publish,
5
+ distribute, sublicense, and/or sell copies of the Software, and to
6
+ permit persons to whom the Software is furnished to do so, subject to
7
+ the following conditions:
8
+
9
+ The above copyright notice and this permission notice shall be
10
+ included in all copies or substantial portions of the Software.
11
+
12
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
13
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
16
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
17
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
18
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,58 @@
1
+ # Null Logger
2
+
3
+ [![Build Status](https://travis-ci.org/karafka/null-logger.svg?branch=master)](https://travis-ci.org/karafka/null-logger)
4
+ [![Code Climate](https://codeclimate.com/github/karafka/null-logger/badges/gpa.svg)](https://codeclimate.com/github/karafka/null-logger)
5
+
6
+ A simple logger that does not log anything. It can be used for defining an interface for other loggers.
7
+
8
+
9
+ ## Installation
10
+
11
+ Add gem to your Gemfile
12
+ ```ruby
13
+ gem 'null-logger'
14
+ ```
15
+
16
+ ## Usage
17
+ On NullLogger instance you can call methods which corresponds to Ruby Logger log levels (unknown, fatal, error, warn, info, debug), ex:
18
+
19
+ ```ruby
20
+ NullLogger.new.fatal # return nil
21
+ NullLogger.new.wrong_method # raise NoMethodError
22
+ ```
23
+
24
+ NullLogger define interface for real logger instance, ex:
25
+
26
+ ```ruby
27
+ class Worker
28
+ class << self
29
+ attr_writer :logger
30
+
31
+ def logger
32
+ @logger ||= NullLogger.new
33
+ end
34
+
35
+ def method()
36
+ # some code
37
+ rescue => exception
38
+ self.class.logger.fatal(exception)
39
+ raise exception
40
+ end
41
+ end
42
+ end
43
+ ```
44
+
45
+ ## Note on Patches/Pull Requests
46
+
47
+ Fork the project.
48
+ Make your feature addition or bug fix.
49
+ Add tests for it. This is important so I don't break it in a future version unintentionally.
50
+ Commit, do not mess with Rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull). Send me a pull request. Bonus points for topic branches.
51
+
52
+ Each pull request must pass our quality requirements. To check if everything is as it should be, we use [PolishGeeks Dev Tools](https://github.com/polishgeeks/polishgeeks-dev-tools) that combine multiple linters and code analyzers. Please run:
53
+
54
+ ```bash
55
+ bundle exec rake
56
+ ```
57
+
58
+ to check if everything is in order. After that you can submit a pull request.
@@ -0,0 +1,18 @@
1
+ require 'bundler'
2
+ require 'bundler/gem_tasks'
3
+ require 'rake'
4
+ require 'polishgeeks-dev-tools'
5
+
6
+ PolishGeeks::DevTools.setup do |config|
7
+ config.brakeman = false
8
+ config.haml_lint = false
9
+ end
10
+
11
+ desc 'Self check using polishgeeks-dev-tools'
12
+ task :check do
13
+ PolishGeeks::DevTools::Runner.new.execute(
14
+ PolishGeeks::DevTools::Logger.new
15
+ )
16
+ end
17
+
18
+ task default: :check
@@ -0,0 +1,16 @@
1
+ # Null logger class
2
+ # Is used when logger is not defined
3
+ class NullLogger
4
+ # Possible log levels from ruby Logger::Severity class
5
+ LOG_LEVELS = %w( unknown fatal error warn info debug )
6
+
7
+ # Returns nil for any method call from LOG_LEVELS array
8
+ # Instead raise NoMethodError
9
+ # @example:
10
+ # NullLogger.new.fatal -> return nil
11
+ # NullLogger.new.wrong_method -> raise NoMethodError
12
+ def method_missing(method_name, *args, &block)
13
+ return nil if LOG_LEVELS.include?(method_name.to_s)
14
+ super(method_name, *args, &block)
15
+ end
16
+ end
@@ -0,0 +1,2 @@
1
+ # null-logger gem Version
2
+ VERSION = '0.1.0'
@@ -0,0 +1,20 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'rake'
4
+ require 'version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "null-logger"
8
+ spec.version = VERSION
9
+ spec.authors = ['Maciej Mensfeld', 'Adam Gwozdowski']
10
+ spec.email = %w( maciej@mensfeld.pl adam99g@gmail.com )
11
+
12
+ spec.summary = 'A simple logger that does not log anything.'
13
+ spec.description = 'It can be used for defining an interface for other loggers'
14
+ spec.homepage = 'https://github.com/karafka/null-logger'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.require_paths = %w( lib )
20
+ end
metadata ADDED
@@ -0,0 +1,60 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: null-logger
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Maciej Mensfeld
8
+ - Adam Gwozdowski
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2015-09-07 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: It can be used for defining an interface for other loggers
15
+ email:
16
+ - maciej@mensfeld.pl
17
+ - adam99g@gmail.com
18
+ executables: []
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - ".gitignore"
23
+ - ".ruby-gemset"
24
+ - ".ruby-version"
25
+ - ".travis.yml"
26
+ - CHANGELOG.md
27
+ - Gemfile
28
+ - Gemfile.lock
29
+ - MIT-LICENCE
30
+ - README.md
31
+ - Rakefile
32
+ - lib/null_logger.rb
33
+ - lib/version.rb
34
+ - null-logger.gemspec
35
+ homepage: https://github.com/karafka/null-logger
36
+ licenses:
37
+ - MIT
38
+ metadata: {}
39
+ post_install_message:
40
+ rdoc_options: []
41
+ require_paths:
42
+ - lib
43
+ required_ruby_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ requirements: []
54
+ rubyforge_project:
55
+ rubygems_version: 2.4.8
56
+ signing_key:
57
+ specification_version: 4
58
+ summary: A simple logger that does not log anything.
59
+ test_files: []
60
+ has_rdoc: