rails-logger-ext 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
@@ -0,0 +1,13 @@
1
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
2
+ Version 2, December 2004
3
+
4
+ Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
5
+
6
+ Everyone is permitted to copy and distribute verbatim or modified
7
+ copies of this license document, and changing it is allowed as long
8
+ as the name is changed.
9
+
10
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
11
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
12
+
13
+ 0. You just DO WHAT THE FUCK YOU WANT TO.
@@ -0,0 +1,54 @@
1
+ # rails-logger-ext
2
+
3
+ this is a simple gem for adding a few methods to the rails logger so i don't have to keep adding the same code to every project. tested with rails 2.3.5 and 3.0.1.
4
+
5
+ ### #pp
6
+ Rails.logger.pp(request)
7
+
8
+ Started GET "/" for 127.0.0.1 at Thu Nov 18 16:45:26 -0800 2010
9
+ Processing by WelcomeController#index as HTML
10
+ #<ActionDispatch::Request:0x1033e3628
11
+ @env=
12
+ {"action_dispatch.request.formats"=>
13
+ [#<Mime::Type:0x101f063b8
14
+ @string="text/html",
15
+ @symbol=:html,
16
+ ...
17
+
18
+ ### #achtung!
19
+ Rails.logger.achtung!("hello")
20
+
21
+ Started GET "/" for 127.0.0.1 at Thu Nov 18 16:46:41 -0800 2010
22
+ Processing by WelcomeController#index as HTML
23
+ --------------------------------------------------
24
+ --------------------------------------------------
25
+ hello
26
+ --------------------------------------------------
27
+ --------------------------------------------------
28
+
29
+ ### greppable
30
+ Rails.logger.greppable(request.env)
31
+
32
+ Started GET "/" for 127.0.0.1 at Thu Nov 18 16:47:35 -0800 2010
33
+ Processing by WelcomeController#index as HTML
34
+ %% - {"action_dispatch.request.formats"=>
35
+ %% - [#<Mime::Type:0x101f063b8
36
+ %% - @string="text/html",
37
+ %% - @symbol=:html,
38
+ %% - @synonyms=["application/xhtml+xml"]>],
39
+ ...
40
+
41
+ ## Contributing to rails-logger-ext
42
+
43
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
44
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
45
+ * Fork the project
46
+ * Start a feature/bugfix branch
47
+ * Commit and push until you are happy with your contribution
48
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
49
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
50
+
51
+ ## Copyright
52
+
53
+ Licensed under WTFPL. See LICENSE.txt for further details.
54
+
@@ -0,0 +1,19 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ require 'jeweler'
5
+ Jeweler::Tasks.new do |gem|
6
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
7
+ gem.name = "rails-logger-ext"
8
+ gem.homepage = "http://github.com/nclark/rails-logger-ext"
9
+ gem.license = "WTFPL"
10
+ gem.summary = %Q{simple rails extension providing Rails.logger.pp and Rails.logger.achtung!}
11
+ gem.description = %Q{simple rails extension providing Rails.logger.pp and Rails.logger.achtung! ... YA HEARD}
12
+ gem.email = "nclark@thrownproject.org"
13
+ gem.authors = ["nclark"]
14
+ # Include your dependencies below. Runtime dependencies are required when using your gem,
15
+ # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
16
+ # gem.add_runtime_dependency 'jabber4r', '> 0.1'
17
+ # gem.add_development_dependency 'rspec', '> 1.2.3'
18
+ end
19
+ Jeweler::RubygemsDotOrgTasks.new
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,11 @@
1
+ module RailsLoggerExt
2
+ require 'rails-logger-ext/extensions'
3
+
4
+ if defined?(Rails)
5
+ if Rails::VERSION::MAJOR == 3
6
+ require 'rails-logger-ext/railtie'
7
+ elsif Rails::VERSION::MAJOR == 2
8
+ ActiveSupport::BufferedLogger.send(:include, RailsLoggerExt::Extensions)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,21 @@
1
+ require 'pp'
2
+
3
+ module RailsLoggerExt
4
+ module Extensions
5
+ def pp(obj)
6
+ info(obj.pretty_inspect)
7
+ end
8
+
9
+ def achtung!(message)
10
+ 2.times { info '-' * 50 }
11
+ info message
12
+ 2.times { info '-' * 50 }
13
+ end
14
+
15
+ def greppable(message)
16
+ message.pretty_inspect.split(/\n/).each do |line|
17
+ info "%% - #{line}"
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,10 @@
1
+ require 'rails-logger-ext'
2
+ require 'rails'
3
+
4
+ module RailsLoggerExt
5
+ class Railtie < Rails::Railtie
6
+ initializer "rails_logger_ext.configure_rails_initialization" do |app|
7
+ ActiveSupport::BufferedLogger.send(:include, RailsLoggerExt::Extensions)
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,46 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{rails-logger-ext}
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["nclark"]
12
+ s.date = %q{2010-11-18}
13
+ s.description = %q{simple rails extension providing Rails.logger.pp and Rails.logger.achtung! ... YA HEARD}
14
+ s.email = %q{nclark@thrownproject.org}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.markdown"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ "LICENSE.txt",
22
+ "README.markdown",
23
+ "Rakefile",
24
+ "VERSION",
25
+ "lib/rails-logger-ext.rb",
26
+ "lib/rails-logger-ext/extensions.rb",
27
+ "lib/rails-logger-ext/railtie.rb",
28
+ "rails-logger-ext.gemspec"
29
+ ]
30
+ s.homepage = %q{http://github.com/nclark/rails-logger-ext}
31
+ s.licenses = ["WTFPL"]
32
+ s.require_paths = ["lib"]
33
+ s.rubygems_version = %q{1.3.7}
34
+ s.summary = %q{simple rails extension providing Rails.logger.pp and Rails.logger.achtung!}
35
+
36
+ if s.respond_to? :specification_version then
37
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
38
+ s.specification_version = 3
39
+
40
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
41
+ else
42
+ end
43
+ else
44
+ end
45
+ end
46
+
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rails-logger-ext
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - nclark
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-11-18 00:00:00 -08:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: simple rails extension providing Rails.logger.pp and Rails.logger.achtung! ... YA HEARD
23
+ email: nclark@thrownproject.org
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files:
29
+ - LICENSE.txt
30
+ - README.markdown
31
+ files:
32
+ - .document
33
+ - LICENSE.txt
34
+ - README.markdown
35
+ - Rakefile
36
+ - VERSION
37
+ - lib/rails-logger-ext.rb
38
+ - lib/rails-logger-ext/extensions.rb
39
+ - lib/rails-logger-ext/railtie.rb
40
+ - rails-logger-ext.gemspec
41
+ has_rdoc: true
42
+ homepage: http://github.com/nclark/rails-logger-ext
43
+ licenses:
44
+ - WTFPL
45
+ post_install_message:
46
+ rdoc_options: []
47
+
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ hash: 3
56
+ segments:
57
+ - 0
58
+ version: "0"
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ hash: 3
65
+ segments:
66
+ - 0
67
+ version: "0"
68
+ requirements: []
69
+
70
+ rubyforge_project:
71
+ rubygems_version: 1.3.7
72
+ signing_key:
73
+ specification_version: 3
74
+ summary: simple rails extension providing Rails.logger.pp and Rails.logger.achtung!
75
+ test_files: []
76
+