justlogging-rails_logger 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 [name of plugin creator]
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.textile ADDED
@@ -0,0 +1,28 @@
1
+ h1. Justlogging
2
+
3
+ This plugin enables easy logging from any Ruby application to our webservice.
4
+
5
+ For other languages checkout:
6
+ * http://www.github.com/justlogging/php_logger
7
+ * http://www.github.com/justlogging/python_logger
8
+
9
+ h2. Install
10
+
11
+ Just install it as a plugin:
12
+ <pre>
13
+ <code>
14
+ $ ./script/plugin install git://github.com/justlogging/rails_logger.git
15
+ $ ./script/generate justlogging
16
+ </code>
17
+ </pre>
18
+
19
+ The generator copies a file called @justlogging.rb@ to the @RAILS_ROOT/config/initializer@ directory. You need to set you api key there and optionally your default log key.
20
+
21
+ h2. Usage
22
+
23
+ @Justlogging.log('this is my first entry')@
24
+
25
+ Easy as pie.
26
+
27
+
28
+ Copyright (c) 2009 Justlogging, released under the MIT license
@@ -0,0 +1,9 @@
1
+ class JustloggingGenerator < Rails::Generator::Base
2
+
3
+ def manifest
4
+ record do |m|
5
+ m.directory 'config/initializers'
6
+ m.file 'justlogging.rb', 'config/initializers/justlogging.rb'
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,4 @@
1
+ Justlogging.configure do |config|
2
+ config.api_key = '1234567890'
3
+ config.log_key = '1234567890'
4
+ end
@@ -0,0 +1,47 @@
1
+ # Justlogging
2
+ require "uri"
3
+ require "net/http"
4
+
5
+ module Justlogging
6
+
7
+ class << self
8
+ attr_accessor :api_key, :log_key
9
+
10
+ def logger
11
+ ActiveRecord::Base.logger
12
+ rescue
13
+ @logger ||= Logger.new(STDERR)
14
+ end
15
+
16
+ def configure
17
+ yield self
18
+ end
19
+
20
+ def url
21
+ URI.parse('http://logs.justlogging.com/log')
22
+ end
23
+
24
+ def log(entry, log_key = self.log_key)
25
+ params = {
26
+ 'log_key' => log_key,
27
+ 'entry' => entry,
28
+ 'access_key' => api_key
29
+ }
30
+
31
+ response = begin
32
+ Net::HTTP.post_form(url, params)
33
+ rescue TimeoutError => e
34
+ logger.error "Timeout while connecting to justlogging." if logger
35
+ nil
36
+ end
37
+
38
+ case response
39
+ when Net::HTTPSuccess then
40
+ logger.info "Justlogging OK" if logger
41
+ else
42
+ logger.error "Justlogging FAIL: #{response.body if response.respond_to? :body}" if logger
43
+ end
44
+ end
45
+
46
+ end
47
+ end
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: justlogging-rails_logger
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Robert Beekman
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-07-13 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: mime-types
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "1.15"
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: diff-lcs
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.1.2
34
+ version:
35
+ description: Justlogging is a webservice that allows you to log just about anything. This is the ruby gem for API interaction.
36
+ email: robert@justlogging.com
37
+ executables: []
38
+
39
+ extensions: []
40
+
41
+ extra_rdoc_files: []
42
+
43
+ files:
44
+ - MIT-LICENSE
45
+ - README.textile
46
+ - lib/justlogging.rb
47
+ - generators/justlogging/justlogging_generator.rb
48
+ - generators/justlogging/templates/justlogging.rb
49
+ has_rdoc: true
50
+ homepage: http://github.com/justlogging/rails_logger
51
+ post_install_message:
52
+ rdoc_options:
53
+ - --inline-source
54
+ - --charset=UTF-8
55
+ require_paths:
56
+ - lib
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: "0"
62
+ version:
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: "0"
68
+ version:
69
+ requirements: []
70
+
71
+ rubyforge_project:
72
+ rubygems_version: 1.2.0
73
+ signing_key:
74
+ specification_version: 2
75
+ summary: rails_logger is a justlogging API wrapper
76
+ test_files: []
77
+