loggability 0.15.0.pre20190714094638 → 0.18.1

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
2
  SHA256:
3
- metadata.gz: 207be54e5100e41c070a6b545448ea603ff0e8a7cf4754149a8c63ec0ed1afe7
4
- data.tar.gz: e50d8153d2da1b21e27dbb919307c9812d6b786a7eb5b6f69a7e045d30c877d8
3
+ metadata.gz: 3972353fd9098e1528c321ce2050e2bddff93525627ce4c5b9c0e29c36422345
4
+ data.tar.gz: 46a978ac5dc8e103a08a1cbab6bd452a9da979ffe4206a493562b1994038ed2a
5
5
  SHA512:
6
- metadata.gz: 21ca3115d9fd4a16515e8b30bad3ba981f3b4c2f42076338aa8008e4037ea408b70e3e90e4821be7f74083022e66075f480f18e4ae4a554a5d9ab1a0f6996a92
7
- data.tar.gz: 02cf4ec3ad18e2f39ea9c1642f527c8e33fdeec54ae8ea109c5cef481d3adb3ef919c4282a317875ee1274ed97558824c7fef283e83e0c022a369a76f869a1ee
6
+ metadata.gz: 54ad86bc78917e2fbe4fd3be76adad200f97c55237282faf8459dc22992eb0d2ff1d71ade493a16a7913d6d30689ef5c87d832b2313330245752b4b8954aad33
7
+ data.tar.gz: 954acba4e933d869a2f6ec8c54c9bad68bd9173b8ddef9f2730e806bc60d901d68b3769e2409a346c5281869c75ce66fb210507e96222c11b6bc7e4150621ae2
Binary file
Binary file
@@ -1,3 +1,66 @@
1
+ = Release History for loggability
2
+
3
+ ---
4
+
5
+ == v0.18.1 [2020-12-28] Michael Granger <ged@faeriemud.org>
6
+
7
+ Improvements:
8
+
9
+ - Change version spec to work with Ruby 3 versions.
10
+
11
+
12
+ == v0.18.0 [2020-12-24] Michael Granger <ged@faeriemud.org>
13
+
14
+ Improvements:
15
+
16
+ - Add memory management to the http log device
17
+ - Add a dead-simple log server example
18
+ - Update for Ruby 3, add my updated gem cert
19
+
20
+ Thanks again to Mahmood Khan <mkhan1484@gmail.com> for the patch.
21
+
22
+
23
+ == v0.17.0 [2020-02-27] Michael Granger <ged@faeriemud.org>
24
+
25
+ Bugfixes:
26
+
27
+ - Fix the construction of the client in the http log device
28
+
29
+ Improvements:
30
+
31
+ - Add support for log devices to the aggregate #output_to
32
+
33
+
34
+
35
+ == v0.16.0 [2020-02-24] Michael Granger <ged@faeriemud.org>
36
+
37
+ Improvements:
38
+
39
+ - Expose a "log device" API and add the ability to write to multiple devices
40
+ - Add a device for logging to an HTTP service
41
+
42
+ Thanks to Mahmood Khan <mkhan1484@gmail.com> for the patch.
43
+
44
+
45
+ == v0.15.1 [2020-01-09] Michael Granger <ged@faeriemud.org>
46
+
47
+ Bugfixes:
48
+
49
+ - Change the spec to require Ruby 2.5 or greater. This was because
50
+ of the use methods that are only public in newer versions.
51
+
52
+
53
+ == v0.15.0 [2020-01-08] Michael Granger <ged@faeriemud.org>
54
+
55
+ (Yanked)
56
+
57
+ Enhancements:
58
+
59
+ - Make literal strings frozen by default
60
+ - Add a structured log formatter.
61
+ - Add fixes for Ruby 2.6 and 2.7
62
+
63
+
1
64
  == v0.14.0 [2017-01-30] Michael Granger <ged@FaerieMUD.org>
2
65
 
3
66
  Enhancements:
@@ -1,9 +1,5 @@
1
1
  .simplecov
2
- ChangeLog
3
2
  History.rdoc
4
- Manifest.txt
5
- README.rdoc
6
- Rakefile
7
3
  lib/loggability.rb
8
4
  lib/loggability/constants.rb
9
5
  lib/loggability/formatter.rb
@@ -14,8 +10,16 @@ lib/loggability/formatter/structured.rb
14
10
  lib/loggability/logclient.rb
15
11
  lib/loggability/logger.rb
16
12
  lib/loggability/loghost.rb
13
+ lib/loggability/log_device.rb
14
+ lib/loggability/log_device/appending.rb
15
+ lib/loggability/log_device/datadog.rb
16
+ lib/loggability/log_device/file.rb
17
+ lib/loggability/log_device/http.rb
17
18
  lib/loggability/override.rb
18
19
  lib/loggability/spechelpers.rb
20
+ Manifest.txt
21
+ Rakefile
22
+ README.md
19
23
  spec/helpers.rb
20
24
  spec/loggability/formatter/color_spec.rb
21
25
  spec/loggability/formatter/default_spec.rb
@@ -24,6 +28,10 @@ spec/loggability/formatter/structured_spec.rb
24
28
  spec/loggability/formatter_spec.rb
25
29
  spec/loggability/logger_spec.rb
26
30
  spec/loggability/loghost_spec.rb
31
+ spec/loggability/log_device/appending_spec.rb
32
+ spec/loggability/log_device/datadog_spec.rb
33
+ spec/loggability/log_device/file_spec.rb
34
+ spec/loggability/log_device/http_spec.rb
27
35
  spec/loggability/override_spec.rb
28
36
  spec/loggability/spechelpers_spec.rb
29
37
  spec/loggability_spec.rb
@@ -1,12 +1,19 @@
1
- = loggability
1
+ # loggability
2
2
 
3
- home :: http://deveiate.org/projects/loggability
4
- code :: http://bitbucket.org/ged/loggability
5
- docs :: http://deveiate.org/code/loggability
6
- github :: http://github.com/ged/loggability
3
+ home
4
+ : https://hg.sr.ht/~ged/Loggability
7
5
 
6
+ code
7
+ : https://hg.sr.ht/~ged/Loggability/browse
8
8
 
9
- == Description
9
+ docs
10
+ : https://deveiate.org/code/loggability
11
+
12
+ github
13
+ : https://github.com/ged/loggability
14
+
15
+
16
+ ## Description
10
17
 
11
18
  A composable logging system built on the standard Logger library.
12
19
 
@@ -21,23 +28,23 @@ An example:
21
28
  require 'inversion'
22
29
  require 'treequel'
23
30
  require 'loggability'
24
-
31
+
25
32
  # Set up our own library
26
33
  module MyProject
27
34
  extend Loggability
28
35
  log_as :my_project
29
-
36
+
30
37
  class Server
31
38
  extend Loggability
32
39
  log_to :my_project
33
-
40
+
34
41
  def initialize
35
42
  self.log.debug "Listening."
36
43
  end
37
44
  end
38
-
45
+
39
46
  end
40
-
47
+
41
48
  # Now tell everything that's using Loggability to log to an HTML
42
49
  # log file at INFO level
43
50
  Loggability.write_to( '/usr/local/www/htdocs/log.html' )
@@ -45,30 +52,30 @@ An example:
45
52
  Loggability.level = :info
46
53
 
47
54
 
48
- == Prerequisites
55
+ ## Prerequisites
49
56
 
50
- * Ruby 1.9.3 or better, Rubinius 2.0 or better
57
+ * Ruby 2.4+
51
58
 
52
59
  It will probably work under any other interpreter in which Logger works, but
53
60
  it's only tested in the above.
54
61
 
55
62
 
56
- == Installation
63
+ ## Installation
57
64
 
58
65
  $ gem install loggability
59
66
 
60
67
 
61
- == Usage
68
+ ## Usage
62
69
 
63
- Loggability is split up into two parts: {log hosts}[rdoc-ref:Loggability::LogHost]
64
- and {log clients}[rdoc-ref:Loggability::LogClient]. A <b>log
70
+ Loggability is split up into two parts: [log hosts](rdoc-ref:Loggability::LogHost)
71
+ and [log clients](rdoc-ref:Loggability::LogClient). A <b>log
65
72
  host</b> is an object that contains a Logger instance that will be used to
66
73
  log stuff. A <b>log client</b> is an object that will write logging messages to a
67
74
  particular <b>log host</b>'s Logger.
68
75
 
69
76
  Both parts require that you extend the object with Loggability.
70
77
 
71
- === Setting Up A 'Log Host'
78
+ ### Setting Up A 'Log Host'
72
79
 
73
80
  To install a Logger into an object, you use the +log_as+ declaration with a
74
81
  Symbol that will be used as the key for the object's Logger:
@@ -116,10 +123,10 @@ or use a few new convenience methods for changing the logging level:
116
123
  log_messages = []
117
124
  MyProject.logger.output_to( log_messages )
118
125
 
119
- ...{and more}[rdoc-ref:Loggability::Logger].
126
+ ...[and more](rdoc-ref:Loggability::Logger).
120
127
 
121
128
 
122
- === Setting Up A 'Log Client'
129
+ ### Setting Up A 'Log Client'
123
130
 
124
131
  To add an object that will log to your log host, after you <tt>extend Loggability</tt>,
125
132
  use the +log_to+ declaration to hook up the object (and instances of the object if
@@ -153,7 +160,7 @@ You can also use the <b>log host</b> itself as the argument to +log_to+:
153
160
  end
154
161
 
155
162
 
156
- === Aggregate Logging
163
+ ### Aggregate Logging
157
164
 
158
165
  If you have several <b>log hosts</b>, and you want to affect them all simultaneously,
159
166
  you can do that using the aggregate functions of Loggability. They're the same as the
@@ -161,15 +168,15 @@ methods on Loggability::Logger:
161
168
 
162
169
  # Set all logs to log at INFO level
163
170
  Loggability.level = :info
164
-
171
+
165
172
  # Write HTML logs
166
173
  Loggability.format_with( :html )
167
-
174
+
168
175
  # Log everything to the same logfile
169
176
  Loggability.output_to( "/tmp/my_project_log.html" )
170
177
 
171
178
 
172
- === Temporarily Overriding Logging Behavior
179
+ ### Temporarily Overriding Logging Behavior
173
180
 
174
181
  Sometimes you want to log one particular chunk of code at a different
175
182
  level, or to a different destination, and then restore everything back
@@ -187,7 +194,7 @@ Loggability has a few ways of doing that:
187
194
  Loggability.outputting_to( logs ) do
188
195
  ...
189
196
  end
190
-
197
+
191
198
  # Log using the HTML formatter
192
199
  Loggability.formatted_with( :html ) do
193
200
  ...
@@ -210,7 +217,7 @@ You can also make the override only apply to the loggers for a subset of log hos
210
217
  ACME.start_up
211
218
  end
212
219
 
213
- === Configurability
220
+ ### Configurability
214
221
 
215
222
  Loggability has support for the Configurability[https://rubygems.org/gems/configurability]
216
223
  library, which does the same thing for configuration that Loggability does for
@@ -230,39 +237,41 @@ The format of the value of each logger is:
230
237
 
231
238
  where:
232
239
 
233
- [+SEVERITY+]
234
- The log level; one of: +debug+, +info+, +warn+, +error+, or +fatal+
235
- [+TARGET+]
236
- The destination for log messages. This can be the path to a log file, or
237
- one of <tt>'STDOUT'</tt> or <tt>'STDERR'</tt>, which get mapped to the
238
- equivalent filehandle. Optional.
239
- [+FORMAT+]
240
- The name of one of the formatters. Loggability comes with +default+ (plaintext),
241
- +color+ (ANSI colored text), and +html+ formatters. Optional.
240
+ +SEVERITY+
241
+ : The log level; one of: +debug+, +info+, +warn+, +error+, or +fatal+
242
242
 
243
- If the special key <tt>__default__</tt> is included, its config will be used to set
244
- global defaults before the individual configs are applied.
243
+ +TARGET+
244
+ : The destination for log messages. This can be the path to a log file, or
245
+ one of <tt>'STDOUT'</tt> or <tt>'STDERR'</tt>, which get mapped to the
246
+ equivalent filehandle. Optional.
245
247
 
246
- If either of the optional values is unspecified, it is left unchanged from what it
247
- was before configuration.
248
+ +FORMAT+
249
+ : The name of one of the formatters. Loggability comes with +default+
250
+ (plaintext), +color+ (ANSI colored text), and +html+ formatters. Optional.
248
251
 
252
+ If the special key <tt>__default__</tt> is included, its config will be used to
253
+ set global defaults before the individual configs are applied.
249
254
 
250
- === RSpec Helpers
255
+ If either of the optional values is unspecified, it is left unchanged from what
256
+ it was before configuration.
251
257
 
252
- Loggability includes a couple of helper functions for RSpec that allow you to control
253
- log levels for particular specs.
254
258
 
255
- To use it, require <tt>loggability/spechelpers</tt> in your specs (we put it in the
256
- spec helpers file) and then include the helpers from your RSpec config:
259
+ ### RSpec Helpers
257
260
 
258
- require 'loggability/spechelpers'
259
- RSpec.configure do |c|
260
- # ...
261
- c.include( Loggability::SpecHelpers )
262
- end
261
+ Loggability includes a couple of helper functions for RSpec that allow you to
262
+ control log levels for particular specs.
263
+
264
+ To use it, require <tt>loggability/spechelpers</tt> in your specs (we put it in
265
+ the spec helpers file) and then include the helpers from your RSpec config:
263
266
 
264
- This will install a before and after `:all` hook to set the logging levels before each
265
- example group and then reset it before moving on to the next group.
267
+ require 'loggability/spechelpers'
268
+ RSpec.configure do |c|
269
+ # ...
270
+ c.include( Loggability::SpecHelpers )
271
+ end
272
+
273
+ This will install a before and after `:all` hook to set the logging levels
274
+ before each example group and then reset it before moving on to the next group.
266
275
 
267
276
  You can also access the bodies of those hooks manually:
268
277
 
@@ -270,31 +279,31 @@ You can also access the bodies of those hooks manually:
270
279
  reset_logging()
271
280
 
272
281
  The helpers also allow you to set logging levels for a whole example group, for
273
- particular contexts, or even for individual examples using RSpec's metadata hash
274
- syntax:
282
+ particular contexts, or even for individual examples using RSpec's metadata
283
+ hash syntax:
275
284
 
276
285
  # Set logging to 'error' level for each example in this group
277
286
  describe MyClass, logging: :error do
278
-
287
+
279
288
  # ...but for examples in this context, set it to 'fatal'
280
289
  context 'created with a target', log: :fatal do
281
-
290
+
282
291
  # ...except for this one, which logs at 'debug' level
283
292
  it "does something to it", logging: :debug do
284
-
293
+
285
294
  end
286
-
295
+
287
296
  it "does some other stuff, too"
288
-
297
+
289
298
  end
290
-
299
+
291
300
  end
292
301
 
293
- The {setup_logging}[rdoc-ref:Loggability::SpecHelpers.setup_logging] helper
302
+ The [setup_logging](rdoc-ref:Loggability::SpecHelpers.setup_logging) helper
294
303
  also provides support for displaying the logs inline with spec formatters for
295
304
  which outputting the logs to STDERR isn't optimal. The only one that's
296
- currently uses it is the
297
- {'webkit' formatter}[https://rubygems.org/gems/rspec-formatter-webkit], but
305
+ currently uses it is the
306
+ ['webkit' formatter](https://rubygems.org/gems/rspec-formatter-webkit), but
298
307
  it should be easy to adapt to other HTML displays as well.
299
308
 
300
309
  It looks for either an +HTML_LOGGING+ environment variable, or for the
@@ -307,23 +316,21 @@ This can be used to append logs to each example when the formatter
307
316
  builds the output.
308
317
 
309
318
 
310
- == Contributing
319
+ ## Contributing
311
320
 
312
321
  You can check out the current development source with
313
- Mercurial[http://bitbucket.org/ged/loggability], or if you prefer Git, via
314
- {its Github mirror}[https://github.com/ged/loggability].
322
+ Mercurial[http://hg.sr.ht/~ged/Loggability], or if you prefer Git, via
323
+ [its Github mirror](https://github.com/ged/loggability).
315
324
 
316
- After checking out the source, run:
317
325
 
318
- $ rake newb
326
+ ## Author
319
327
 
320
- This task will install any missing dependencies, run the tests/specs,
321
- and generate the API documentation.
328
+ - Michael Granger <ged@faeriemud.org>
322
329
 
323
330
 
324
- == License
331
+ ## License
325
332
 
326
- Copyright (c) 2012-2017, Michael Granger
333
+ Copyright (c) 2012-2020, Michael Granger
327
334
  All rights reserved.
328
335
 
329
336
  Redistribution and use in source and binary forms, with or without
data/Rakefile CHANGED
@@ -1,82 +1,9 @@
1
- #!/usr/bin/env rake
1
+ #!/usr/bin/env ruby -S rake
2
2
 
3
- require 'rake/clean'
3
+ require 'rake/deveiate'
4
4
 
5
- begin
6
- require 'hoe'
7
- rescue LoadError
8
- abort "This Rakefile requires 'hoe' (gem install hoe)"
5
+ Rake::DevEiate.setup( 'loggability' ) do |project|
6
+ project.required_ruby_version = ['~> 2.5', '>= 3.0']
7
+ project.publish_to = 'deveiate:/usr/local/www/public/code'
9
8
  end
10
9
 
11
- GEMSPEC = 'loggability.gemspec'
12
-
13
- Hoe.plugin :mercurial
14
- Hoe.plugin :signing
15
- Hoe.plugin :deveiate
16
-
17
- Hoe.plugins.delete :rubyforge
18
-
19
- hoespec = Hoe.spec 'loggability' do
20
- self.readme_file = 'README.rdoc'
21
- self.history_file = 'History.rdoc'
22
- self.extra_rdoc_files = FileList[ '*.rdoc' ]
23
-
24
- self.developer 'Michael Granger', 'ged@FaerieMUD.org'
25
-
26
- self.dependency 'hoe-deveiate', '~> 0.4', :developer
27
- self.dependency 'hoe-bundler', '~> 1.2', :developer
28
- self.dependency 'simplecov', '~> 0.7', :developer
29
- self.dependency 'configurability', '~> 3.1', :developer
30
- self.dependency 'timecop', '~> 0.9', :developer
31
-
32
- self.license "BSD-3-Clause"
33
- self.require_ruby_version( '>=1.9.3' )
34
- self.hg_sign_tags = true if self.respond_to?( :hg_sign_tags= )
35
- self.check_history_on_release = true if self.respond_to?( :check_history_on_release= )
36
-
37
- self.rdoc_locations << "deveiate:/usr/local/www/public/code/#{remote_rdoc_dir}"
38
- end
39
-
40
- ENV['VERSION'] ||= hoespec.spec.version.to_s
41
-
42
- # Ensure the specs pass before checking in
43
- task 'hg:precheckin' => [ :check_history, :check_manifest, :gemspec, :spec ]
44
-
45
-
46
- desc "Build a coverage report"
47
- task :coverage do
48
- ENV["COVERAGE"] = 'yes'
49
- Rake::Task[:spec].invoke
50
- end
51
- CLOBBER.include( 'coverage' )
52
-
53
-
54
- # Use the fivefish formatter for docs generated from development checkout
55
- if File.directory?( '.hg' )
56
- require 'rdoc/task'
57
-
58
- Rake::Task[ 'docs' ].clear
59
- RDoc::Task.new( 'docs' ) do |rdoc|
60
- rdoc.main = "README.rdoc"
61
- rdoc.rdoc_files.include( "*.rdoc", "ChangeLog", "lib/**/*.rb" )
62
- rdoc.generator = :fivefish
63
- rdoc.title = 'Loggability'
64
- rdoc.rdoc_dir = 'doc'
65
- end
66
- end
67
-
68
- task :gemspec => GEMSPEC
69
- file GEMSPEC => [ __FILE__, 'lib/loggability.rb' ]
70
- task GEMSPEC do |task|
71
- hoespec = $hoespec.spec
72
- hoespec.files.delete( '.gemtest' )
73
- hoespec.signing_key = nil
74
- hoespec.version = "#{hoespec.version.bump}.0.pre#{Time.now.strftime("%Y%m%d%H%M%S")}"
75
- hoespec.cert_chain = [ 'certs/ged.pem' ]
76
- File.open( task.name, 'w' ) do |fh|
77
- fh.write( hoespec.to_ruby )
78
- end
79
- end
80
-
81
- CLOBBER.include( GEMSPEC.to_s )
82
-