logging-rails 0.1.0 → 0.2.0

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/History.txt CHANGED
@@ -1,4 +1,11 @@
1
- == 0.1.0 / 2011-09-13
1
+ == 0.2.0 / 2011-09-16
2
+
3
+ Enhancements
4
+ - Using the ActionMailer smtp settings
5
+ - Sanity checks for Rails and Rails.version
6
+ - Handling difference in "config.paths" between Rails 3.0 and Rails 3.1
7
+
8
+ == 0.1.0 / 2011-09-16
2
9
 
3
10
  Enhancements
4
11
  - Birthday!
data/README.md CHANGED
@@ -1,7 +1,8 @@
1
1
  logging-rails
2
2
  =============
3
3
 
4
- A Railtie for for integrating the [Logging](https://github.com/TwP/logging) framework into your Rails 3 application.
4
+ A Railtie for for integrating the [Logging](https://github.com/TwP/logging)
5
+ framework into your Rails 3 application.
5
6
 
6
7
  Features
7
8
  --------
@@ -16,7 +17,8 @@ gem 'logging-rails', :require => 'logging/rails'
16
17
  ````
17
18
 
18
19
  A generator is included with the railtie that will create a ```config/logging.rb```
19
- configuration file for use in your rails project.
20
+ configuration file for use in your rails project. Please run this generator
21
+ before attempting use the logging framework.
20
22
 
21
23
  ```
22
24
  rails generate logging:install
@@ -25,6 +27,11 @@ rails generate logging:install
25
27
  Usage
26
28
  -----
27
29
 
30
+ Out of the box, the Logging framework is configured to behave in the same way
31
+ as the standard Rails logger setup. The major exception is that the log file
32
+ will be rolled daily - gone are the days of 2GB log files on production
33
+ servers.
34
+
28
35
  config.log_to
29
36
 
30
37
  Logging.logger['ModelName'].level = :debug
@@ -43,7 +50,7 @@ License
43
50
 
44
51
  The MIT License
45
52
 
46
- Copyright (c) 2011 by Tim Pease
53
+ Copyright © 2011 by Tim Pease
47
54
 
48
55
  Permission is hereby granted, free of charge, to any person obtaining
49
56
  a copy of this software and associated documentation files (the
@@ -6,7 +6,7 @@ module Logging::Rails
6
6
  source_root File.expand_path('../templates', __FILE__)
7
7
 
8
8
  def generate_config
9
- copy_file 'logging.rb', 'config/logging.rb'
9
+ template 'logging.rb.erb', 'config/logging.rb'
10
10
  end
11
11
  end
12
12
  end
@@ -42,7 +42,7 @@ Logging::Rails.configure do |config|
42
42
  # formatting log events into strings.
43
43
  #
44
44
  Logging.appenders.rolling_file( 'file',
45
- :filename => config.paths['log'].first,
45
+ :filename => config.paths<%= Rails.version < "3.1" ? ".log" : "['log']" %>.first,
46
46
  :keep => 7,
47
47
  :age => 'daily',
48
48
  :truncate => false,
@@ -56,14 +56,14 @@ Logging::Rails.configure do |config|
56
56
  # is done to prevent a flood of messages.
57
57
  #
58
58
  Logging.appenders.email( 'email',
59
- :from => 'server@example.com',
60
- :to => 'developers@example.com',
61
- :server => 'smtp.example.com',
62
- :domain => 'example.com',
63
- :acct => 'server@example.com',
64
- :passwd => 'password',
59
+ :from => "server@#{config.action_mailer.smtp_settings[:domain]}",
60
+ :to => "developers@#{config.action_mailer.smtp_settings[:domain]}",
65
61
  :subject => "Rails Error [#{%x(uname -n).strip}]",
66
- :authtype => :login,
62
+ :server => config.action_mailer.smtp_settings[:address],
63
+ :domain => config.action_mailer.smtp_settings[:domain],
64
+ :acct => config.action_mailer.smtp_settings[:user_name],
65
+ :passwd => config.action_mailer.smtp_settings[:password],
66
+ :authtype => config.action_mailer.smtp_settings[:authentication],
67
67
 
68
68
  :auto_flushing => 200, # send an email after 200 messages have been buffered
69
69
  :flush_period => 60, # send an email after one minute
@@ -1,4 +1,12 @@
1
1
 
2
+ if !defined? Rails or Rails.version
3
+ abort('The Logging Railtie only works in the context of a Rails application')
4
+ end
5
+
6
+ if Rails.version < '3'
7
+ abort("The Logging Railtie only works with Rails 3 or higher - you are running Rails #{Rails.version}")
8
+ end
9
+
2
10
  module Logging::Rails
3
11
 
4
12
  # The Railtie is used to inject the Logging framework into the Rails
data/version.txt CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logging-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-09-16 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: logging
16
- requirement: &2166095040 !ruby/object:Gem::Requirement
16
+ requirement: &2163091300 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.6.1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2166095040
24
+ version_requirements: *2163091300
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bones
27
- requirement: &2166094440 !ruby/object:Gem::Requirement
27
+ requirement: &2163090480 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,15 +32,17 @@ dependencies:
32
32
  version: 3.7.1
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2166094440
36
- description: A Railtie for for integrating the [Logging](https://github.com/TwP/logging)
37
- framework into your Rails 3 application.
35
+ version_requirements: *2163090480
36
+ description: ! 'A Railtie for for integrating the [Logging](https://github.com/TwP/logging)
37
+
38
+ framework into your Rails 3 application.'
38
39
  email: tim.pease@gmail.com
39
40
  executables: []
40
41
  extensions: []
41
42
  extra_rdoc_files:
42
43
  - History.txt
43
44
  - lib/logging/rails/generators/USAGE
45
+ - lib/logging/rails/generators/templates/logging.rb.erb
44
46
  files:
45
47
  - History.txt
46
48
  - README.md
@@ -49,7 +51,7 @@ files:
49
51
  - lib/logging/rails.rb
50
52
  - lib/logging/rails/generators/USAGE
51
53
  - lib/logging/rails/generators/install_generator.rb
52
- - lib/logging/rails/generators/templates/logging.rb
54
+ - lib/logging/rails/generators/templates/logging.rb.erb
53
55
  - lib/logging/rails/mixin.rb
54
56
  - lib/logging/rails/railtie.rb
55
57
  - version.txt