loggability 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
@@ -1 +1,2 @@
1
- ?�R�<��R��?�pmC:�kΊda����$}#eY��}G �����lM+ۋ�|i��� �>!
2
1
  #���.����j����m9��h�e���F1d�d�"�y�u�ƀѰ�����-���5@�+���߱�a��ึ�����C>[��kv:���F�a���6P�/l&٧�GJjl�=�^��ST��
2
+ ��[-���p5���A&A���
3
+ ��f)�{�3F�l/�m�N����X#׆����P^��D>0��5��"H���ccB�����E;�pJF��"P��y�Z"�S������!i>nl���D����֬��f�����;mZ��NRj��[���>����,@3�'�Â��:�4e��}}i���?�´�P���ڛH ��2VЩf�Ȝ�hQ�E���V�~���
data/ChangeLog CHANGED
@@ -1,8 +1,30 @@
1
+ 2012-06-06 Michael Granger <ged@FaerieMUD.org>
2
+
3
+ * .hgtags:
4
+ Added tag v0.4.0 for changeset b5e9220fe7a9
5
+ [740a4e834be2] [tip]
6
+
7
+ * .hgsigs:
8
+ Added signature for changeset 2615ed217d34
9
+ [b5e9220fe7a9] [v0.4.0]
10
+
11
+ * History.rdoc, lib/loggability.rb:
12
+ Bump the minor version, update history.
13
+ [2615ed217d34]
14
+
15
+ * lib/loggability.rb, lib/loggability/logger.rb,
16
+ spec/loggability/logger_spec.rb, spec/loggability_spec.rb:
17
+ Add some conversion-convenience code.
18
+
19
+ Auto-convert Logger instances into Loggability::Logger instances
20
+ with the same device if assigned directly, etc.
21
+ [943e0a67d246]
22
+
1
23
  2012-05-26 Michael Granger <ged@FaerieMUD.org>
2
24
 
3
25
  * .hgtags:
4
26
  Added tag v0.3.0 for changeset 6c526d42bafb
5
- [581580843d12] [tip]
27
+ [581580843d12]
6
28
 
7
29
  * .hgsigs:
8
30
  Added signature for changeset 7b6ef57de872
@@ -21,7 +43,7 @@
21
43
  * lib/loggability/formatter.rb, spec/loggability/formatter_spec.rb,
22
44
  spec/loggability/logger_spec.rb:
23
45
  Downcase the severity before outputting.
24
- [040bb1a5dc84] [github/master]
46
+ [040bb1a5dc84]
25
47
 
26
48
  2012-05-18 Michael Granger <ged@FaerieMUD.org>
27
49
 
data/History.rdoc CHANGED
@@ -1,3 +1,9 @@
1
+ == v0.5.0 [2012-08-03] Michael Granger <ged@FaerieMUD.org>
2
+
3
+ - Remove dependency on PluginFactory/Pluggability to avoid circular
4
+ dependency.
5
+
6
+
1
7
  == v0.4.0 [2012-05-26] Michael Granger <ged@FaerieMUD.org>
2
8
 
3
9
  - Add some conversion-convenience code. You can now assign ::Logger
data/Rakefile CHANGED
@@ -21,8 +21,6 @@ hoespec = Hoe.spec 'loggability' do
21
21
 
22
22
  self.developer 'Michael Granger', 'ged@FaerieMUD.org'
23
23
 
24
- self.dependency 'pluginfactory', '~> 1.0'
25
-
26
24
  self.dependency 'hoe-deveiate', '~> 0.1', :developer
27
25
  self.dependency 'simplecov', '~> 0.6', :developer
28
26
  self.dependency 'configurability', '~> 1.2', :developer
data/lib/loggability.rb CHANGED
@@ -9,10 +9,10 @@ require 'date'
9
9
  module Loggability
10
10
 
11
11
  # Package version constant
12
- VERSION = '0.4.0'
12
+ VERSION = '0.5.0'
13
13
 
14
14
  # VCS revision
15
- REVISION = %q$Revision: 2615ed217d34 $
15
+ REVISION = %q$Revision: 0db162246900 $
16
16
 
17
17
  # The key for the global logger (Loggability's own logger)
18
18
  GLOBAL_KEY = :__global__
@@ -2,26 +2,47 @@
2
2
  # vim: set nosta noet ts=4 sw=4:
3
3
  # encoding: utf-8
4
4
 
5
- require 'pluginfactory'
6
-
7
5
  require 'loggability' unless defined?( Loggability )
8
6
 
9
7
 
10
8
  ### An abstract base class for Loggability log formatters.
11
9
  class Loggability::Formatter
12
- extend PluginFactory
13
10
 
14
11
  # The default sprintf pattern
15
12
  DEFAULT_DATETIME_FORMAT = '%Y-%m-%d %H:%M:%S'
16
13
 
17
14
 
18
- ### PluginFactory API -- return the Array of paths prefixes to use when searching
19
- ### formatter plugins.
20
- def self::derivative_dirs
21
- return ['loggability/formatter']
15
+ ##
16
+ # Derivative classes, keyed by name
17
+ class << self; attr_reader :derivatives; end
18
+ @derivatives = {}
19
+
20
+
21
+ ### Inherited hook -- add subclasses to the ::derivatives Array.
22
+ def self::inherited( subclass )
23
+ super
24
+ classname = subclass.name.sub( /.*::/, '' ).downcase.to_sym
25
+ Loggability::Formatter.derivatives[ classname ] = subclass
26
+ end
27
+
28
+
29
+ ### Create a formatter of the specified +type+, loading it if it hasn't already been
30
+ ### loaded.
31
+ def self::create( type, *args )
32
+ require "loggability/formatter/#{type}"
33
+ type = type.to_sym
34
+
35
+ if self.derivatives.key?( type )
36
+ return self.derivatives[ type ].new( *args )
37
+ else
38
+ raise LoadError,
39
+ "require of %s formatter succeeded (%p), but it didn't load a class named %p::%s" %
40
+ [ type, self.derivatives, self, type.to_s.capitalize ]
41
+ end
22
42
  end
23
43
 
24
44
 
45
+
25
46
  ### Initialize a new Loggability::Formatter. The specified +logformat+ should
26
47
  ### be a sprintf pattern with positional placeholders:
27
48
  ###
@@ -16,11 +16,6 @@ require 'loggability/formatter/default'
16
16
 
17
17
  describe Loggability::Formatter do
18
18
 
19
- it "loads plugins out of loggability/formatter" do
20
- Loggability::Formatter.derivative_dirs.should == ['loggability/formatter']
21
- end
22
-
23
-
24
19
  it "formats messages with the pattern it's constructed with" do
25
20
  formatter = Loggability::Formatter.new( '[%5$s] %7$s' )
26
21
  formatter.call( 'INFO', Time.at(1336286481), nil, 'Foom.' ).should =~
@@ -216,7 +216,7 @@ describe Loggability do
216
216
  it "raises an error if configured with a bogus formatter" do
217
217
  expect {
218
218
  Loggability.configure( 'class1' => 'debug (mindwaves)' )
219
- }.to raise_error( FactoryError, /couldn't find a formatter/i )
219
+ }.to raise_error( LoadError, /cannot load such file/i )
220
220
  end
221
221
 
222
222
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loggability
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -36,24 +36,8 @@ cert_chain:
36
36
  YUhDS0xaZFNLai9SSHVUT3QrZ2JsUmV4OEZBaDhOZUEKY21saFhlNDZwWk5K
37
37
  Z1dLYnhaYWg4NWpJang5NWhSOHZPSStOQU01aUg5a09xSzEzRHJ4YWNUS1Bo
38
38
  cWo1UGp3RgotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
39
- date: 2012-06-07 00:00:00.000000000 Z
39
+ date: 2012-08-03 00:00:00.000000000 Z
40
40
  dependencies:
41
- - !ruby/object:Gem::Dependency
42
- name: pluginfactory
43
- requirement: !ruby/object:Gem::Requirement
44
- none: false
45
- requirements:
46
- - - ~>
47
- - !ruby/object:Gem::Version
48
- version: '1.0'
49
- type: :runtime
50
- prerelease: false
51
- version_requirements: !ruby/object:Gem::Requirement
52
- none: false
53
- requirements:
54
- - - ~>
55
- - !ruby/object:Gem::Version
56
- version: '1.0'
57
41
  - !ruby/object:Gem::Dependency
58
42
  name: hoe-mercurial
59
43
  requirement: !ruby/object:Gem::Requirement
metadata.gz.sig CHANGED
Binary file