artifact_logger 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/artifact_logger/active_record.rb +0 -6
- data/lib/artifact_logger/model_extensions.rb +19 -13
- metadata +39 -21
@@ -4,12 +4,6 @@ module ArtifactLogger::ActiveRecord
|
|
4
4
|
|
5
5
|
module ClassMethods
|
6
6
|
def enable_artifact_logger options={}
|
7
|
-
#Configure the has_many
|
8
|
-
has_many :log, :as => :artifact, :class_name => '::Log::Message', :dependent => :destroy, :autosave => true
|
9
|
-
#Store the old logging method
|
10
|
-
alias_method :_log, :log
|
11
|
-
remove_method :log
|
12
|
-
|
13
7
|
include ArtifactLogger::ModelExtensions
|
14
8
|
|
15
9
|
#Store the levels which are valid
|
@@ -2,6 +2,14 @@
|
|
2
2
|
module ArtifactLogger::ModelExtensions
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
|
+
included do
|
6
|
+
#Configure the has_many
|
7
|
+
has_many :log, :as => :artifact, :class_name => '::Log::Message', :dependent => :destroy, :autosave => true
|
8
|
+
|
9
|
+
alias :_log :log
|
10
|
+
# remove_method :log if method_defined? :log
|
11
|
+
end
|
12
|
+
|
5
13
|
module ClassMethods
|
6
14
|
#Provides two different functionalities:
|
7
15
|
# Artifact.log # => log message object
|
@@ -25,20 +33,18 @@ module ArtifactLogger::ModelExtensions
|
|
25
33
|
end
|
26
34
|
end
|
27
35
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
ArtifactLogger.extend_log_object(_log(*params), self)
|
37
|
-
end
|
36
|
+
#Provides two different functionalities:
|
37
|
+
# artifact.log # => log message object
|
38
|
+
# artifact.log :level, "Message" # Creates a new message
|
39
|
+
def log *params
|
40
|
+
if params.length == 2
|
41
|
+
Log::Message.create :level => params[0], :text => params[1], :artifact => self
|
42
|
+
else
|
43
|
+
ArtifactLogger.extend_log_object(_log(*params), self)
|
38
44
|
end
|
45
|
+
end
|
39
46
|
|
40
|
-
|
41
|
-
|
42
|
-
end
|
47
|
+
def valid_log_levels
|
48
|
+
return self.class.valid_log_levels
|
43
49
|
end
|
44
50
|
end
|
metadata
CHANGED
@@ -1,23 +1,32 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: artifact_logger
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 2
|
8
|
+
- 1
|
9
|
+
version: 1.2.1
|
6
10
|
platform: ruby
|
7
|
-
authors:
|
11
|
+
authors:
|
8
12
|
- Adam T Kerr
|
9
13
|
autorequire:
|
10
14
|
bindir: bin
|
11
15
|
cert_chain: []
|
12
|
-
|
16
|
+
|
17
|
+
date: 2012-04-02 00:00:00 -04:00
|
18
|
+
default_executable:
|
13
19
|
dependencies: []
|
14
|
-
|
15
|
-
|
20
|
+
|
21
|
+
description: A very simple dropin engine for logging information on artifacts in a database.
|
16
22
|
email: artifact_logger.rubygems@adamkerr.net
|
17
23
|
executables: []
|
24
|
+
|
18
25
|
extensions: []
|
26
|
+
|
19
27
|
extra_rdoc_files: []
|
20
|
-
|
28
|
+
|
29
|
+
files:
|
21
30
|
- lib/artifact_logger/active_record.rb
|
22
31
|
- lib/artifact_logger/model_extensions.rb
|
23
32
|
- lib/artifact_logger/engine.rb
|
@@ -29,28 +38,37 @@ files:
|
|
29
38
|
- MIT-LICENSE
|
30
39
|
- Rakefile
|
31
40
|
- README.rdoc
|
41
|
+
has_rdoc: true
|
32
42
|
homepage: http://github.com/ajrkerr/artifact_logger/
|
33
43
|
licenses: []
|
44
|
+
|
34
45
|
post_install_message:
|
35
46
|
rdoc_options: []
|
36
|
-
|
47
|
+
|
48
|
+
require_paths:
|
37
49
|
- lib
|
38
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
39
51
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
segments:
|
56
|
+
- 0
|
57
|
+
version: "0"
|
58
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
59
|
none: false
|
46
|
-
requirements:
|
47
|
-
- -
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
segments:
|
64
|
+
- 0
|
65
|
+
version: "0"
|
50
66
|
requirements: []
|
67
|
+
|
51
68
|
rubyforge_project:
|
52
|
-
rubygems_version: 1.
|
69
|
+
rubygems_version: 1.3.7
|
53
70
|
signing_key:
|
54
71
|
specification_version: 3
|
55
72
|
summary: A simple dropin engine for logging information on artifacts in a databse.
|
56
73
|
test_files: []
|
74
|
+
|