deployable-log 0.5.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 +7 -0
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +37 -0
- data/Rakefile +7 -0
- data/changelog.md +5 -0
- data/deployable-log.gemspec +25 -0
- data/lib/deployable/log.rb +245 -0
- data/lib/deployable/log/version.rb +5 -0
- data/spec/deployable/log_spec.rb +40 -0
- data/spec/deployable/logger_spec.rb +143 -0
- data/spec/deployable/module_spec.rb +36 -0
- data/spec/spec_helper.rb +3 -0
- metadata +119 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9de861a529291094dcc61ce6ff06050407bd065e
|
4
|
+
data.tar.gz: 504ee51401e2349290d49da172696945e7a126f3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 98f522f9b89869d8940d7957b224298f75442c025079921ffb7f2d05d76768e59f55e76918df0c27c92b830e2ac34bcd2f74a57b40624d0d3cbfddb3e1067206
|
7
|
+
data.tar.gz: 42016b87b2c7d6b78ae160219cc29f84e5f3b11d244d11a0b3fe73f43b834d8e94b2c4353b89510e80febd62a7f730b7e0ac87148be766a4da7dafcf5a5ca139
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 deployable
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# Deployable::Log
|
2
|
+
|
3
|
+
Deployable::Log creates a singleton log instance that will be accessible
|
4
|
+
via the `log` function where ever you require `deployable/log`
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'deployable-log'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself
|
19
|
+
|
20
|
+
$ gem install deployable-log
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
require 'deplyoable/log'
|
25
|
+
|
26
|
+
include Deployable::Log
|
27
|
+
|
28
|
+
log.info "all the information"
|
29
|
+
|
30
|
+
|
31
|
+
## Contributing
|
32
|
+
|
33
|
+
1. Fork it ( https://github.com/deployable/deployable-log/fork )
|
34
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
35
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
36
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
37
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/changelog.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'deployable/log/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "deployable-log"
|
8
|
+
spec.version = Deployable::Log::VERSION
|
9
|
+
spec.authors = ["deployable"]
|
10
|
+
spec.email = ["matt@deployable.co"]
|
11
|
+
spec.summary = %q{Log singleton}
|
12
|
+
spec.description = %q{Log singleton}
|
13
|
+
spec.homepage = "http://deployable.co"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency "rspec", "~> 3.1"
|
24
|
+
spec.add_development_dependency "pry-byebug", "~> 2.0"
|
25
|
+
end
|
@@ -0,0 +1,245 @@
|
|
1
|
+
require "deployable/log/version"
|
2
|
+
require 'logger'
|
3
|
+
|
4
|
+
### Log - a global logger instance for classes
|
5
|
+
#
|
6
|
+
# Allows you to call a single logger instance easily from your classes
|
7
|
+
#
|
8
|
+
# class Yours
|
9
|
+
# include Log
|
10
|
+
# def method
|
11
|
+
# log.info 'something'
|
12
|
+
# end
|
13
|
+
# end
|
14
|
+
|
15
|
+
module Deployable
|
16
|
+
|
17
|
+
|
18
|
+
# Create a custom instance of the Ruby `logger`.
|
19
|
+
# We add a bunch of hlper log methods
|
20
|
+
class Logger < Logger
|
21
|
+
|
22
|
+
# Add on TRACE to the logger class
|
23
|
+
TRACE = -1
|
24
|
+
module Severity;
|
25
|
+
TRACE = -1
|
26
|
+
end
|
27
|
+
include Severity
|
28
|
+
def trace( progname = nil, &block )
|
29
|
+
add( TRACE, nil, progname, &block )
|
30
|
+
end
|
31
|
+
def trace?; @level <= TRACE; end
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
def trace_each tag, iter #, &block
|
36
|
+
return if @level > TRACE
|
37
|
+
iter.each do |m|
|
38
|
+
add( TRACE, nil, "#{tag} #{m}" )
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def debug_each tag, iter #, &block
|
43
|
+
return if @level > DEBUG
|
44
|
+
iter.each do |m|
|
45
|
+
add( DEBUG, nil, "#{tag} #{m}" )
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def info_each tag, iter #, &block
|
50
|
+
return if @level > INFO
|
51
|
+
iter.each do |m|
|
52
|
+
add( INFO, nil, "#{tag} #{m}" )
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def error_each tag, iter #, &block
|
57
|
+
return if @level > ERROR
|
58
|
+
iter.each do |m|
|
59
|
+
add( ERROR, nil, "#{tag} #{m}" )
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def fatal_each tag, iter #, &block
|
64
|
+
return if @level > FATAL
|
65
|
+
iter.each do |m|
|
66
|
+
add( FATAL, nil, "#{tag} #{m}" )
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
|
71
|
+
# Var loggers
|
72
|
+
def trace_var *args, &block
|
73
|
+
return if @level > TRACE
|
74
|
+
message = block_given? ? build_var(yield) : build_var(*args)
|
75
|
+
add( TRACE, nil, message )
|
76
|
+
end
|
77
|
+
|
78
|
+
def debug_var *args, &block
|
79
|
+
return if @level > DEBUG
|
80
|
+
message = block_given? ? build_var(yield) : build_var(*args)
|
81
|
+
add( DEBUG, nil, message )
|
82
|
+
end
|
83
|
+
|
84
|
+
def info_var *args, &block
|
85
|
+
return if @level > INFO
|
86
|
+
message = block_given? ? build_var(yield) : build_var(*args)
|
87
|
+
add( INFO, nil, message )
|
88
|
+
end
|
89
|
+
|
90
|
+
def warn_var *args, &block
|
91
|
+
return if @level > WARN
|
92
|
+
message = block_given? ? build_var(yield) : build_var(*args)
|
93
|
+
add( WARN, nil, message )
|
94
|
+
end
|
95
|
+
|
96
|
+
def error_var *args, &block
|
97
|
+
return if @level > ERROR
|
98
|
+
message = block_given? ? build_var(yield) : build_var(*args)
|
99
|
+
add( ERROR, nil, message )
|
100
|
+
end
|
101
|
+
|
102
|
+
def fatal_var *args, &block
|
103
|
+
return if @level > FATAL
|
104
|
+
message = block_given? ? build_var(yield) : build_var(*args)
|
105
|
+
add( FATAL, nil, message )
|
106
|
+
end
|
107
|
+
|
108
|
+
|
109
|
+
# Pair loggers
|
110
|
+
def trace_pair *args, &block
|
111
|
+
return if @level > TRACE
|
112
|
+
message = block_given? ? build_pair(yield) : build_pair(*args)
|
113
|
+
add( TRACE, nil, message )
|
114
|
+
end
|
115
|
+
|
116
|
+
def debug_pair *args, &block
|
117
|
+
return if @level > DEBUG
|
118
|
+
message = block_given? ? build_pair(yield) : build_pair(*args)
|
119
|
+
add( DEBUG, nil, message )
|
120
|
+
end
|
121
|
+
|
122
|
+
def info_pair *args, &block
|
123
|
+
return if @level > INFO
|
124
|
+
message = block_given? ? build_pair(yield) : build_pair(*args)
|
125
|
+
add( INFO, nil, message )
|
126
|
+
end
|
127
|
+
|
128
|
+
def warn_pair *args, &block
|
129
|
+
return if @level > WARN
|
130
|
+
message = block_given? ? build_pair(yield) : build_pair(*args)
|
131
|
+
add( WARN, nil, message )
|
132
|
+
end
|
133
|
+
|
134
|
+
def error_pair *args, &block
|
135
|
+
return if @level > ERROR
|
136
|
+
message = block_given? ? build_pair(yield) : build_pair(*args)
|
137
|
+
add( ERROR, nil, message )
|
138
|
+
end
|
139
|
+
|
140
|
+
def fatal_pair *args, &block
|
141
|
+
return if @level > FATAL
|
142
|
+
message = block_given? ? build_pair(yield) : build_pair(*args)
|
143
|
+
add( FATAL, nil, message )
|
144
|
+
end
|
145
|
+
|
146
|
+
|
147
|
+
# Fatal and error to raise
|
148
|
+
def fatal_raise error, *args, &block
|
149
|
+
return if @level > FATAL
|
150
|
+
message = block_given? ? build_pair(yield) : build_pair(*args)
|
151
|
+
add( FATAL, nil, message )
|
152
|
+
raise error, message
|
153
|
+
end
|
154
|
+
|
155
|
+
def error_raise error, *args, &block
|
156
|
+
return if @level > ERROR
|
157
|
+
message = block_given? ? build_pair(yield) : build_pair(*args)
|
158
|
+
add( ERROR, nil, message )
|
159
|
+
raise error, message
|
160
|
+
end
|
161
|
+
|
162
|
+
private
|
163
|
+
|
164
|
+
# Creates a string of vars log:
|
165
|
+
# message text [var1] [var2] [var3]
|
166
|
+
def build_var *args
|
167
|
+
line = "#{args[0]}"
|
168
|
+
# bracket [] any additional arguments
|
169
|
+
line << " [#{args[1...args.length].join('] [')}]" if args.length > 1
|
170
|
+
line
|
171
|
+
end
|
172
|
+
|
173
|
+
# Creates a string of pairs to log (useful for hashes too)
|
174
|
+
# var1 [val1] var2 [val2]
|
175
|
+
def build_pair *args
|
176
|
+
args = args.to_a unless args.respond_to? :each_slice
|
177
|
+
args.each_slice(2).map{|name,var| "#{name} [#{var}]" }.join(' ')
|
178
|
+
end
|
179
|
+
|
180
|
+
end
|
181
|
+
|
182
|
+
|
183
|
+
# A singleton interface to the Deployable logger
|
184
|
+
#
|
185
|
+
module Log
|
186
|
+
|
187
|
+
# Default output
|
188
|
+
#DefaultIO = STDOUT
|
189
|
+
DefaultIO = $stdout
|
190
|
+
|
191
|
+
|
192
|
+
class << self
|
193
|
+
|
194
|
+
# create a new logger
|
195
|
+
# Doesn't impact the singleton
|
196
|
+
def create_log io = DefaultIO, level = ::Deployable::Logger::INFO
|
197
|
+
l = ::Deployable::Logger.new io
|
198
|
+
l.level = level
|
199
|
+
l
|
200
|
+
end
|
201
|
+
|
202
|
+
# Replace the singleton logger with a new target/level
|
203
|
+
def replace_log io = DefaultIO, level = @log.level
|
204
|
+
l = ::Deployable::Logger.new io, level
|
205
|
+
#l.level = @log.level
|
206
|
+
@log = l
|
207
|
+
end
|
208
|
+
|
209
|
+
# Set the level for the logger
|
210
|
+
def log_level level
|
211
|
+
level = Deployable::Logger.const_get level.upcase unless
|
212
|
+
level.kind_of? ::Fixnum
|
213
|
+
|
214
|
+
@log.level = level
|
215
|
+
end
|
216
|
+
|
217
|
+
# Add `.log` to the instance of the class
|
218
|
+
# Return the singleton or create it
|
219
|
+
def log
|
220
|
+
@log #||= Log.create
|
221
|
+
end
|
222
|
+
|
223
|
+
# Add `.log` to the class instance on include
|
224
|
+
def included base
|
225
|
+
class << base
|
226
|
+
def log
|
227
|
+
Deployable::Log.log
|
228
|
+
end
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
end
|
233
|
+
|
234
|
+
# Module instance variable to hold the singleton logger instance
|
235
|
+
@log = create_log
|
236
|
+
|
237
|
+
# Adds `.log` method to the class instance to return the singleton
|
238
|
+
def log
|
239
|
+
::Deployable::Log.log
|
240
|
+
end
|
241
|
+
|
242
|
+
end
|
243
|
+
|
244
|
+
|
245
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Deployable::Log do
|
4
|
+
|
5
|
+
|
6
|
+
describe 'initial' do
|
7
|
+
|
8
|
+
it 'has a version number' do
|
9
|
+
expect(Deployable::Log::VERSION).not_to be nil
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
describe 'module include' do
|
17
|
+
|
18
|
+
it 'can get a log instance' do
|
19
|
+
expect( Deployable::Log.log ).not_to be nil
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'gets the same instance' do
|
23
|
+
expect( Deployable::Log.log ).to be Deployable::Log.log
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'log_level' do
|
27
|
+
expect( Deployable::Log.log_level(1) ).to be 1
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'log_level name' do
|
31
|
+
expect( Deployable::Log.log_level :DEBUG ).to be 0
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'log_level via symbol' do
|
35
|
+
expect( Deployable::Log.log_level 'DEBUG' ).to be 0
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
@@ -0,0 +1,143 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Deployable::Logger do
|
4
|
+
|
5
|
+
describe 'simple' do
|
6
|
+
|
7
|
+
before :each do
|
8
|
+
@io = StringIO.new
|
9
|
+
@log = Deployable::Log.create_log @io
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'trace' do
|
13
|
+
@log.level = Deployable::Logger::TRACE
|
14
|
+
@log.trace 'testt'
|
15
|
+
expect( @io.string ).to end_with ": testt\n"
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'debug' do
|
19
|
+
@log.level = Deployable::Logger::DEBUG
|
20
|
+
@log.debug 'testd'
|
21
|
+
expect( @io.string ).to end_with ": testd\n"
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'info' do
|
25
|
+
@log.level = Deployable::Logger::INFO
|
26
|
+
@log.info 'testi'
|
27
|
+
expect( @io.string ).to end_with ": testi\n"
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'warn' do
|
31
|
+
@log.level = Deployable::Logger::WARN
|
32
|
+
@log.warn 'testw'
|
33
|
+
expect( @io.string ).to end_with ": testw\n"
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'error' do
|
37
|
+
@log.level = Deployable::Logger::ERROR
|
38
|
+
@log.error 'teste'
|
39
|
+
expect( @io.string ).to end_with ": teste\n"
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'fatal' do
|
43
|
+
@log.level = Deployable::Logger::FATAL
|
44
|
+
@log.fatal 'testf'
|
45
|
+
expect( @io.string ).to end_with ": testf\n"
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
describe 'var' do
|
52
|
+
|
53
|
+
before :each do
|
54
|
+
@io = StringIO.new
|
55
|
+
@log = Deployable::Log.create_log @io
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'trace' do
|
59
|
+
@log.level = Deployable::Logger::TRACE
|
60
|
+
@log.trace_var 'test',1
|
61
|
+
expect( @io.string ).to end_with ": test [1]\n"
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'debug' do
|
65
|
+
@log.level = Deployable::Logger::DEBUG
|
66
|
+
@log.debug_var 'test',2
|
67
|
+
expect( @io.string ).to end_with ": test [2]\n"
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'info' do
|
71
|
+
@log.level = Deployable::Logger::INFO
|
72
|
+
@log.info_var 'test',3
|
73
|
+
expect( @io.string ).to end_with ": test [3]\n"
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'warn' do
|
77
|
+
@log.level = Deployable::Logger::WARN
|
78
|
+
@log.warn_var 'test',4
|
79
|
+
expect( @io.string ).to end_with ": test [4]\n"
|
80
|
+
end
|
81
|
+
|
82
|
+
it 'error' do
|
83
|
+
@log.level = Deployable::Logger::ERROR
|
84
|
+
@log.error_var 'test',5
|
85
|
+
expect( @io.string ).to end_with ": test [5]\n"
|
86
|
+
end
|
87
|
+
|
88
|
+
it 'fatal' do
|
89
|
+
@log.level = Deployable::Logger::FATAL
|
90
|
+
@log.fatal_var 'test',6
|
91
|
+
expect( @io.string ).to end_with ": test [6]\n"
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
|
96
|
+
|
97
|
+
describe 'pair' do
|
98
|
+
|
99
|
+
before :each do
|
100
|
+
@io = StringIO.new
|
101
|
+
@log = Deployable::Log.create_log @io
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'trace' do
|
105
|
+
@log.level = Deployable::Logger::TRACE
|
106
|
+
@log.trace_pair 'test', 1, 2,3
|
107
|
+
expect( @io.string ).to end_with ": test [1] 2 [3]\n"
|
108
|
+
end
|
109
|
+
|
110
|
+
it 'debug' do
|
111
|
+
@log.level = Deployable::Logger::DEBUG
|
112
|
+
@log.debug_pair 'test', 2,3,4
|
113
|
+
expect( @io.string ).to end_with ": test [2] 3 [4]\n"
|
114
|
+
end
|
115
|
+
|
116
|
+
it 'info' do
|
117
|
+
@log.level = Deployable::Logger::INFO
|
118
|
+
@log.info_pair 'test', 3,4,5
|
119
|
+
expect( @io.string ).to end_with ": test [3] 4 [5]\n"
|
120
|
+
end
|
121
|
+
|
122
|
+
it 'warn' do
|
123
|
+
@log.level = Deployable::Logger::WARN
|
124
|
+
@log.warn_pair 'test', 4,5,6
|
125
|
+
expect( @io.string ).to end_with ": test [4] 5 [6]\n"
|
126
|
+
end
|
127
|
+
|
128
|
+
it 'error' do
|
129
|
+
@log.level = Deployable::Logger::ERROR
|
130
|
+
@log.error_pair 'test', 5,6,7
|
131
|
+
expect( @io.string ).to end_with ": test [5] 6 [7]\n"
|
132
|
+
end
|
133
|
+
|
134
|
+
it 'fatal' do
|
135
|
+
@log.level = Deployable::Logger::FATAL
|
136
|
+
@log.fatal_pair 'test', 6,7,8
|
137
|
+
expect( @io.string ).to end_with ": test [6] 7 [8]\n"
|
138
|
+
end
|
139
|
+
|
140
|
+
end
|
141
|
+
|
142
|
+
|
143
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Deployable::Log module include' do
|
4
|
+
|
5
|
+
describe 'simple' do
|
6
|
+
|
7
|
+
before :all do
|
8
|
+
|
9
|
+
class TestThis
|
10
|
+
# logger for instance of this class and the class instance itself
|
11
|
+
include Deployable::Log
|
12
|
+
end
|
13
|
+
|
14
|
+
@io = StringIO.new
|
15
|
+
@log = Deployable::Log.log
|
16
|
+
Deployable::Log.replace_log @io
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'has a class logger' do
|
20
|
+
expect( TestThis.log ).to be_a Deployable::Logger
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'has an instance logger' do
|
24
|
+
expect( TestThis.new.log ).to be_a Deployable::Logger
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'class logger goes into instance logger' do
|
28
|
+
TestThis.new.log.info 'something'
|
29
|
+
TestThis.log.info 'otherthing'
|
30
|
+
expect( @io.string ).to match( /.+?: something\n.+?: otherthing\n/m )
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: deployable-log
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- deployable
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.1'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.1'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry-byebug
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.0'
|
69
|
+
description: Log singleton
|
70
|
+
email:
|
71
|
+
- matt@deployable.co
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rspec"
|
78
|
+
- ".travis.yml"
|
79
|
+
- Gemfile
|
80
|
+
- LICENSE.txt
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- changelog.md
|
84
|
+
- deployable-log.gemspec
|
85
|
+
- lib/deployable/log.rb
|
86
|
+
- lib/deployable/log/version.rb
|
87
|
+
- spec/deployable/log_spec.rb
|
88
|
+
- spec/deployable/logger_spec.rb
|
89
|
+
- spec/deployable/module_spec.rb
|
90
|
+
- spec/spec_helper.rb
|
91
|
+
homepage: http://deployable.co
|
92
|
+
licenses:
|
93
|
+
- MIT
|
94
|
+
metadata: {}
|
95
|
+
post_install_message:
|
96
|
+
rdoc_options: []
|
97
|
+
require_paths:
|
98
|
+
- lib
|
99
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
requirements: []
|
110
|
+
rubyforge_project:
|
111
|
+
rubygems_version: 2.2.2
|
112
|
+
signing_key:
|
113
|
+
specification_version: 4
|
114
|
+
summary: Log singleton
|
115
|
+
test_files:
|
116
|
+
- spec/deployable/log_spec.rb
|
117
|
+
- spec/deployable/logger_spec.rb
|
118
|
+
- spec/deployable/module_spec.rb
|
119
|
+
- spec/spec_helper.rb
|