object_logging 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/object_logging.rb +8 -0
- data/lib/object_logging/log/rails_cache.rb +1 -1
- data/lib/object_logging/logger.rb +1 -1
- data/object_logging.gemspec +2 -2
- data/test/object_logging_test.rb +5 -3
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/lib/object_logging.rb
CHANGED
@@ -39,6 +39,14 @@ module ObjectLogging
|
|
39
39
|
|
40
40
|
module InstanceMethods
|
41
41
|
|
42
|
+
def object_logging
|
43
|
+
if instance_of?(Class)
|
44
|
+
self.metaclass.object_logging
|
45
|
+
else
|
46
|
+
self.class.object_logging
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
42
50
|
def logger
|
43
51
|
@logger ||= Logger.new(self)
|
44
52
|
@logger.objectify(self)
|
@@ -38,7 +38,7 @@ module ObjectLogging
|
|
38
38
|
private
|
39
39
|
|
40
40
|
def instantiate_log(object)
|
41
|
-
type, options = object.
|
41
|
+
type, options = object.object_logging
|
42
42
|
type = "base", options = {} if type.nil?
|
43
43
|
class_name = type.to_s.split("_").collect{ |word| word.capitalize }.join
|
44
44
|
klass = ObjectLogging::Log.const_get(class_name)
|
data/object_logging.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{object_logging}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Christopher J. Bottaro"]
|
12
|
-
s.date = %q{2010-05-
|
12
|
+
s.date = %q{2010-05-13}
|
13
13
|
s.description = %q{It's a pain to trudge through large log files. Sometimes you just want to see log messages for one particular object.}
|
14
14
|
s.email = %q{cjbottaro@alumni.cs.utexas.edu}
|
15
15
|
s.extra_rdoc_files = [
|
data/test/object_logging_test.rb
CHANGED
@@ -49,9 +49,11 @@ class ObjectLoggingTest < Test::Unit::TestCase
|
|
49
49
|
def test_inheritance
|
50
50
|
p = Person.new
|
51
51
|
s = Schmuck.new
|
52
|
-
assert_equal p.
|
53
|
-
|
54
|
-
assert_equal
|
52
|
+
assert_equal ObjectLogging::Log::RailsLog, p.logger.instance_variable_get("@log").class
|
53
|
+
assert_equal ObjectLogging::Log::RailsLog, s.logger.instance_variable_get("@log").class
|
54
|
+
assert_equal p.object_logging, s.object_logging
|
55
|
+
assert_not_equal p.object_logging.object_id, s.object_logging.object_id
|
56
|
+
assert_equal([:rails_log, {}], s.object_logging)
|
55
57
|
end
|
56
58
|
|
57
59
|
def test_static
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 1
|
9
|
+
version: 0.2.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Christopher J. Bottaro
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-05-
|
17
|
+
date: 2010-05-13 00:00:00 -05:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|