rails_syslogger 0.1.0 → 0.1.1
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/lib/rails_syslogger.rb +5 -3
- data/lib/rails_syslogger/version.rb +1 -1
- metadata +3 -3
data/lib/rails_syslogger.rb
CHANGED
@@ -5,13 +5,13 @@ require 'rails'
|
|
5
5
|
module RailsSyslogger
|
6
6
|
|
7
7
|
class Railtie < Rails::Railtie
|
8
|
-
initializer "rails_syslogger.initialize_default_logger" do
|
9
|
-
config.logger = RailsSyslogger.assign_syslogger_by_environment
|
8
|
+
initializer "rails_syslogger.initialize_default_logger" do |app|
|
9
|
+
app.config.logger = RailsSyslogger.assign_syslogger_by_environment
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
def self.assign_syslogger_by_environment( hostname = default_hostname, facility = Syslog::LOG_LOCAL5 )
|
14
|
-
|
14
|
+
Syslogger.new( hostname, Syslog::LOG_PID, facility ) if should_use_syslog?
|
15
15
|
end
|
16
16
|
|
17
17
|
class << self
|
@@ -21,9 +21,11 @@ module RailsSyslogger
|
|
21
21
|
rails_pathname = Pathname.new( ::Rails.root.to_s ).expand_path
|
22
22
|
|
23
23
|
# read the symlink if it is a symlink
|
24
|
+
# often this will be a symlink of current to releases/<release>
|
24
25
|
rails_pathname = rails_pathname.readlink if rails_pathname.symlink?
|
25
26
|
|
26
27
|
# get the hostname by backing up two directories
|
28
|
+
# this assumes structure of <rails_root>/releases/<release_number>
|
27
29
|
hostname = rails_pathname.parent.parent.basename.to_s
|
28
30
|
|
29
31
|
# add 'www.' prefix to hostname if no subdomain
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_syslogger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-06-14 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: syslogger
|
16
|
-
requirement: &
|
16
|
+
requirement: &70334209113480 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: 1.2.4
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70334209113480
|
25
25
|
description: This allows you to set some nice default syslog configuration options
|
26
26
|
for your rails environment, using syslog for all production and development environments,
|
27
27
|
except your local development environment. Set the environment variable "RAILS_DEV"
|