justlogging-justlogging-rails_logger 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ require File.dirname(__FILE__) + '/rails/init'
@@ -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
data/rails/init.rb ADDED
@@ -0,0 +1,2 @@
1
+ # Include hook code here
2
+ require 'justlogging'
metadata ADDED
@@ -0,0 +1,61 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: justlogging-justlogging-rails_logger
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.3
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
+
16
+ description: Justlogging is a webservice that allows you to log just about anything. This is the ruby gem for API interaction.
17
+ email: robert@justlogging.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - MIT-LICENSE
26
+ - README.textile
27
+ - lib/justlogging.rb
28
+ - generators/justlogging/justlogging_generator.rb
29
+ - generators/justlogging/templates/justlogging.rb
30
+ - rails/init.rb
31
+ - init.rb
32
+ has_rdoc: true
33
+ homepage: http://github.com/justlogging/rails_logger
34
+ licenses:
35
+ post_install_message:
36
+ rdoc_options:
37
+ - --inline-source
38
+ - --charset=UTF-8
39
+ require_paths:
40
+ - lib
41
+ required_ruby_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: "0"
46
+ version:
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: "0"
52
+ version:
53
+ requirements: []
54
+
55
+ rubyforge_project:
56
+ rubygems_version: 1.3.5
57
+ signing_key:
58
+ specification_version: 2
59
+ summary: rails_logger is a justlogging API wrapper
60
+ test_files: []
61
+