catamaran 0.9.1 → 0.10.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c51065cdb4214656604cdb61802d5eb574698f5f
4
- data.tar.gz: 7fa689f18bade04142e110bc5693b6370e168034
3
+ metadata.gz: de217e176b2cb0c6ac1dc6e0b99b4bb2297383ea
4
+ data.tar.gz: d062ac5460294965d8ced97e2431d8c24f039b07
5
5
  SHA512:
6
- metadata.gz: e6f186c028aa5ce1cd5db49971b723862d7e141f0fc9daf902dee4a1961ec9e4667bb83681b177bde6d6c037ef7e47419379de11fca2576c752a0b32eb431655
7
- data.tar.gz: 7b7750e9d5eaaeb882902b0637b0f9ae2b7e3cec5d444093a6e23ddf9e1b6f68239e421e64e9d4876f8340e131a7c5487f684a139fc48651f316a9ca7267f997
6
+ metadata.gz: cb3e3f5099b0e621064b25d2a55365d3c48557fd991bc11989ea61c0242784825e80c487425cb9fb176fd02c10f294689bfad561918079b760278d33c62bef70
7
+ data.tar.gz: b975c7e774b21315aa50ea6ff8a1245db8b6df63da987aabe40c7b38dd7ee7cbbd1386a3534a27bdee12b910ca10b5ac47891bc3c69df1d419200941f1f06406
data/README.md CHANGED
@@ -6,7 +6,7 @@ Logging is a powerful and often undervalued tool in software development. When
6
6
  Gemfile
7
7
  -------
8
8
 
9
- gem 'catamaran', '~> 0.9.1'
9
+ gem 'catamaran', '~> 0.10.0'
10
10
 
11
11
  Rails-related setup:
12
12
 
@@ -35,6 +35,7 @@ class FirstRubyDemo
35
35
  LOGGER.warn( "WARN logs are captured by default" )
36
36
  LOGGER.error( "ERROR logs are captured by default" )
37
37
  LOGGER.severe( "SEVERE logs are captured by default" )
38
+ LOGGER.fatal( "FATAL logs are captured by default" )
38
39
  end
39
40
  end
40
41
 
@@ -48,6 +49,7 @@ NOTICE pid-23773 [2014-01-01 13:09:47:551] com.mytld.FirstRu
48
49
  WARN pid-23773 [2014-01-01 13:09:47:551] com.mytld.FirstRubyDemo - WARN logs are captured by default
49
50
  ERROR pid-23773 [2014-01-01 13:09:47:551] com.mytld.FirstRubyDemo - ERROR logs are captured by default
50
51
  SEVERE pid-23773 [2014-01-01 13:09:47:551] com.mytld.FirstRubyDemo - SEVERE logs are captured by default
52
+ FATAL pid-23773 [2014-01-01 13:09:47:551] com.mytld.FirstRubyDemo - FATAL logs are captured by default
51
53
  ```
52
54
 
53
55
 
@@ -55,11 +57,11 @@ Rails Quickstart
55
57
  ----------------
56
58
 
57
59
  ```ruby
58
- class PagesController < ApplicationController
59
- LOGGER = Catamaran.logger.com.mytld.myrailsapp.app.controllers.PagesController
60
+ class WidgetsController < ApplicationController
61
+ LOGGER = Catamaran.logger.com.mytld.myrailsapp.app.controllers.WidgetsController
60
62
 
61
63
  def index
62
- LOGGER.debug "Entering with params = #{params}" if LOGGER.debug?
64
+ LOGGER.debug "Handling a Widgets index request with params = #{params}" if LOGGER.debug?
63
65
  end
64
66
  end
65
67
  ```
@@ -68,7 +70,7 @@ Load the `index` page and check out your `development.log` file
68
70
 
69
71
  ### Sample log entry (in your development.log file)
70
72
 
71
- DEBUG pid-86000 [2013-12-17 17:26:39:176] ytld.myrailsapp.app.controllers.PagesController - Entering with params = {"controller"=>"pages", "action"=>"index"} (`/myrailsapp/app/controllers/pages_controller.rb:7`:in `index`)
73
+ DEBUG pid-86000 [2013-12-17 17:26:39:176] ld.myrailsapp.app.controllers.WidgetsController - "Handling a Widgets index request with params = {"controller"=>"widgets", "action"=>"index"} (`/myrailsapp/app/controllers/widgets_controller.rb:7`:in `index`)
72
74
 
73
75
  Log Levels
74
76
  ----------
@@ -129,12 +131,13 @@ I'm looking for a logging utility that:
129
131
  * captures from where each log entry was generated
130
132
  * works equally well with classes that do and do *not* extend Rails base classes
131
133
  * supports the TRACE log level (or other log level less critical than DEBUG).
132
- * is capable of capturing logs at different severity thresholds from different parts of the app simultaneously
134
+ * is capable of capturing logs at different severity thresholds from different parts of the app simultaneously (I always liked the Named Hierarchy and Level Inheritance aspects of log4j)
133
135
  * readily works with Rails
134
136
  * http://stackoverflow.com/questions/462651/rails-logger-format-string-configuration
135
137
  * http://stackoverflow.com/questions/3654827/logging-in-rails-app
136
138
  * http://stackoverflow.com/questions/11991967/rails-log-too-verbose
137
139
  * http://www.ietf.org/rfc/rfc3164.txt
140
+ * http://logging.apache.org/log4j/1.2
138
141
 
139
142
  Performance Considerations
140
143
  --------------------------
@@ -281,3 +284,4 @@ Ideas around what's next
281
284
 
282
285
 
283
286
 
287
+
@@ -148,7 +148,7 @@ module Catamaran
148
148
  end
149
149
 
150
150
  def trace( msg, opts = nil )
151
- # Duplicated the logic from trace? for performance considerations
151
+ # Duplicated the logic from trace?() (rather than calling it directly) for performance considerations
152
152
  if self.log_level( { :be_populated => true } ) <= LogLevel::TRACE
153
153
  log( LogLevel::TRACE, msg, opts )
154
154
  end
@@ -166,7 +166,7 @@ module Catamaran
166
166
  end
167
167
 
168
168
  def debug( msg, opts = nil )
169
- # Duplicated the logic from debug? for performance considerations
169
+ # Duplicated the logic from debug?() (rather than calling it directly) for performance considerations
170
170
  if self.log_level( { :be_populated => true } ) <= LogLevel::DEBUG
171
171
  log( LogLevel::DEBUG, msg, opts )
172
172
  end
@@ -185,7 +185,7 @@ module Catamaran
185
185
  end
186
186
 
187
187
  def io( msg, opts = nil )
188
- # Duplicated the logic from io? for performance considerations
188
+ # Duplicated the logic from io?() (rather than calling it directly) for performance considerations
189
189
  if self.log_level( { :be_populated => true } ) <= LogLevel::IO
190
190
  log( LogLevel::IO, msg, opts )
191
191
  end
@@ -203,7 +203,7 @@ module Catamaran
203
203
  end
204
204
 
205
205
  def info( msg, opts = nil )
206
- # Duplicated the logic from info? for performance considerations
206
+ # Duplicated the logic from info?() (rather than calling it directly) for performance considerations
207
207
  if self.log_level( { :be_populated => true } ) <= LogLevel::INFO
208
208
  log( LogLevel::INFO, msg, opts )
209
209
  end
@@ -221,7 +221,7 @@ module Catamaran
221
221
  end
222
222
 
223
223
  def notice( msg, opts = nil )
224
- # Duplicated the logic from notice? for performance considerations
224
+ # Duplicated the logic from notice?() (rather than calling it directly) for performance considerations
225
225
  if self.log_level( { :be_populated => true } ) <= LogLevel::NOTICE
226
226
  log( LogLevel::NOTICE, msg, opts )
227
227
  end
@@ -239,7 +239,7 @@ module Catamaran
239
239
  end
240
240
 
241
241
  def warn( msg, opts = nil )
242
- # Duplicated the logic from warn? for performance considerations
242
+ # Duplicated the logic from warn?() (rather than calling it directly) for performance considerations
243
243
  if self.log_level( { :be_populated => true } ) <= LogLevel::WARN
244
244
  log( LogLevel::WARN, msg, opts )
245
245
  end
@@ -257,7 +257,7 @@ module Catamaran
257
257
  end
258
258
 
259
259
  def error( msg, opts = nil )
260
- # Duplicated the logic from error? for performance considerations
260
+ # Duplicated the logic from error?() (rather than calling it directly) for performance considerations
261
261
  if self.log_level( { :be_populated => true } ) <= LogLevel::ERROR
262
262
  log( LogLevel::ERROR, msg, opts )
263
263
  end
@@ -275,7 +275,7 @@ module Catamaran
275
275
  end
276
276
 
277
277
  def severe( msg, opts = nil )
278
- # Duplicated the logic from severe? for performance considerations
278
+ # Duplicated the logic from severe?() (rather than calling it directly) for performance considerations
279
279
  if self.log_level( { :be_populated => true } ) <= LogLevel::SEVERE
280
280
  log( LogLevel::SEVERE, msg, opts )
281
281
  end
@@ -284,19 +284,19 @@ module Catamaran
284
284
  ##
285
285
  # Is fatal-level logging currently enabled?
286
286
 
287
- # def fatal?
288
- # if self.smart_log_level() <= LogLevel::FATAL
289
- # true
290
- # else
291
- # false
292
- # end
293
- # end
294
-
295
- # def fatal( msg, opts = nil )
296
- # if fatal?
297
- # log( LogLevel::FATAL, msg, opts )
298
- # end
299
- # end
287
+ def fatal?
288
+ if self.smart_log_level() <= LogLevel::FATAL
289
+ true
290
+ else
291
+ false
292
+ end
293
+ end
294
+
295
+ def fatal( msg, opts = nil )
296
+ if fatal?
297
+ log( LogLevel::FATAL, msg, opts )
298
+ end
299
+ end
300
300
 
301
301
 
302
302
 
@@ -1,4 +1,4 @@
1
1
  module Catamaran
2
- VERSION = '0.9.1'
2
+ VERSION = '0.10.0'
3
3
  end
4
4
 
@@ -273,6 +273,28 @@ describe Catamaran do
273
273
  Catamaran.logger.whatever.smart_log_level.should_not be_nil
274
274
  end
275
275
 
276
+ it "should support the TRACE log severity and trace()" do
277
+ Catamaran.logger.log_level = Catamaran::LogLevel::TRACE
278
+ Catamaran.logger.should_receive( :log ).once
279
+ Catamaran.logger.trace( "A TRACE log should be received" )
280
+ end
281
+
282
+ it "should support the TRACE log severity and trace?()" do
283
+ Catamaran.logger.log_level = Catamaran::LogLevel::TRACE
284
+ Catamaran.logger.trace?.should be_true
285
+ end
286
+
287
+ it "should support the FATAL log severity and fatal()" do
288
+ Catamaran.logger.smart_log_level.should < Catamaran::LogLevel::FATAL
289
+ Catamaran.logger.should_receive( :log ).once
290
+ Catamaran.logger.fatal( "A FATAL log should be received" )
291
+ end
292
+
293
+ it "should support the FATAL log severity and fatal?()" do
294
+ Catamaran.logger.smart_log_level.should < Catamaran::LogLevel::FATAL
295
+ Catamaran.logger.fatal?.should be_true
296
+ end
297
+
276
298
  it "should write the log message if the requested log does have sufficient severity" do
277
299
  Catamaran.logger.smart_log_level.should <= Catamaran::LogLevel::NOTICE
278
300
  Catamaran.logger.should_receive( :log ).once
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: catamaran
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeano