artifact_logger 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/README.rdoc +37 -5
  2. metadata +3 -3
data/README.rdoc CHANGED
@@ -2,17 +2,49 @@
2
2
 
3
3
  This is an engine which is designed to be a drop-in logging agent for use in a Rails application.
4
4
 
5
+ It's designed to be pretty simple and easy to use.
6
+
5
7
  Usage:
6
8
 
7
9
  # app/models/artifact.rb
8
10
 
9
11
  class Artifact < ActiveRecord::Base
10
- has_many 'Log::Messages', :as => :artifacts
11
-
12
+ #levels are optional
13
+ enable_artifact_logger :levels => [:info, :warning, :error, :custom]
12
14
  end
13
15
 
14
- art = Artifact.new
16
+ Log::Message {
17
+ :level => :info, # Defaults to :info, :warning, or :error
18
+ :text => "your message here",
19
+ :artifact => Artifact # Either the artifact it's attached to
20
+ }
21
+
22
+ a = Artifact.new
23
+
24
+ # To create an error or info message in the log
25
+ m = a.log "error", "This is an error message!"
26
+ n = a.log.info "This is an error message!"
27
+
28
+ #Both of these will display the same information
29
+ a.log #> [m, n]
30
+ a.log.error #> [m, n]
31
+
32
+ m.artifact #> a
33
+ m.artifact_type #> Artifact
34
+
35
+
36
+ #This is also usable on the model itself
37
+ info = Article.log "info", "Article did something"
38
+ warn = Article.log.warning "Article did something else"
39
+
40
+ Article.log #> [warn, info]
41
+ Article.log.warning #> [warn]
42
+
43
+ info.artifact #> Artifact
44
+ info.artifact_type #> Artifact
15
45
 
16
- art.log("Error", "This is an error message")
17
46
 
18
- art.logs
47
+ Future Plans:
48
+ - Add some arbitrary linking (ie. allowing a user to be associated with a log message)
49
+ - Add support for message types (ie. a second dimension of arbitrary scoping)
50
+ - Explore the possiblity of tagging instead of levels and types
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: artifact_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ default_executable:
14
14
  dependencies: []
15
15
  description: A very simple dropin engine for logging information on artifacts in a
16
16
  database.
17
- email:
17
+ email: artifact_logger.rubygems@adamkerr.net
18
18
  executables: []
19
19
  extensions: []
20
20
  extra_rdoc_files: []
@@ -28,7 +28,7 @@ files:
28
28
  - Rakefile
29
29
  - README.rdoc
30
30
  has_rdoc: true
31
- homepage:
31
+ homepage: http://github.com/ajrkerr/artifact_logger/
32
32
  licenses: []
33
33
  post_install_message:
34
34
  rdoc_options: []