rails_syslogger 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in rails_syslogger.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,33 @@
1
+ require 'syslogger'
2
+
3
+ module RailsSyslogger
4
+
5
+ def self.assign_syslogger_by_environment( hostname = default_hostname, facility = Syslog::LOG_LOCAL5 )
6
+ Syslogger.new( hostname, Syslog::LOG_PID, Syslog::LOG_LOCAL5 ) if should_use_syslog?
7
+ end
8
+
9
+ class << self
10
+
11
+ def default_hostname
12
+ # start with the base application path
13
+ rails_pathname = Pathname.new( RAILS_ROOT ).expand_path
14
+
15
+ # read the symlink if it is a symlink
16
+ rails_pathname = rails_pathname.readlink if rails_pathname.symlink?
17
+
18
+ # get the hostname by backing up two directories
19
+ hostname = rails_pathname.parent.parent.basename.to_s
20
+
21
+ # add 'www.' prefix to hostname if no subdomain
22
+ hostname = 'www.' + hostname if hostname.scan('.').size == 1
23
+
24
+ hostname
25
+ end
26
+
27
+ def should_use_syslog?
28
+ ENV['RAILS_DEV'] != 'true'
29
+ end
30
+
31
+ end
32
+
33
+ end
@@ -0,0 +1,3 @@
1
+ module RailsSyslogger
2
+ VERSION = "0.0.3"
3
+ end
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "rails_syslogger/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "rails_syslogger"
7
+ s.version = RailsSyslogger::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Joe Osburn"]
10
+ s.email = ["josburn@iexposure.com"]
11
+ s.homepage = "http://www.iexposure.com"
12
+ s.summary = %q{Nice default behavior for rails and syslogger.}
13
+ s.description = %q{This allows you to set some nice default syslog configuration options for your rails environment, using syslog for all production and development environments, except your local development environment. Set the environment variable "RAILS_DEV" to "true" to not use sysloger.}
14
+
15
+ s.add_dependency( 'syslogger', '~> 1.2.4' )
16
+
17
+ s.rubyforge_project = "rails_syslogger"
18
+
19
+ s.files = `git ls-files`.split("\n")
20
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
22
+ s.require_paths = ["lib"]
23
+ end
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rails_syslogger
3
+ version: !ruby/object:Gem::Version
4
+ hash: 25
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 3
10
+ version: 0.0.3
11
+ platform: ruby
12
+ authors:
13
+ - Joe Osburn
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-05-19 00:00:00 -05:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: syslogger
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 23
30
+ segments:
31
+ - 1
32
+ - 2
33
+ - 4
34
+ version: 1.2.4
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ description: This allows you to set some nice default syslog configuration options for your rails environment, using syslog for all production and development environments, except your local development environment. Set the environment variable "RAILS_DEV" to "true" to not use sysloger.
38
+ email:
39
+ - josburn@iexposure.com
40
+ executables: []
41
+
42
+ extensions: []
43
+
44
+ extra_rdoc_files: []
45
+
46
+ files:
47
+ - .gitignore
48
+ - Gemfile
49
+ - Rakefile
50
+ - lib/rails_syslogger.rb
51
+ - lib/rails_syslogger/version.rb
52
+ - rails_syslogger.gemspec
53
+ has_rdoc: true
54
+ homepage: http://www.iexposure.com
55
+ licenses: []
56
+
57
+ post_install_message:
58
+ rdoc_options: []
59
+
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ hash: 3
68
+ segments:
69
+ - 0
70
+ version: "0"
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ hash: 3
77
+ segments:
78
+ - 0
79
+ version: "0"
80
+ requirements: []
81
+
82
+ rubyforge_project: rails_syslogger
83
+ rubygems_version: 1.5.0
84
+ signing_key:
85
+ specification_version: 3
86
+ summary: Nice default behavior for rails and syslogger.
87
+ test_files: []
88
+