sensu 0.8.5 → 0.8.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/sensu.rb +1 -1
  2. data/lib/sensu/config.rb +9 -2
  3. metadata +3 -3
data/lib/sensu.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sensu
2
- VERSION = "0.8.5"
2
+ VERSION = "0.8.6"
3
3
  end
data/lib/sensu/config.rb CHANGED
@@ -14,8 +14,12 @@ module Sensu
14
14
 
15
15
  def initialize(options={})
16
16
  @logger = Cabin::Channel.new
17
- log_dir = File.writable?('/var/log') ? '/var/log' : '/tmp'
18
- ruby_logger = Logger.new(File.join(log_dir, 'sensu.log'))
17
+ log_file = options[:log_file] || '/tmp/sensu.log'
18
+ if File.writable?(log_file) || !File.exist?(log_file) && File.writable?(File.dirname(log_file))
19
+ ruby_logger = Logger.new(log_file)
20
+ else
21
+ invalid_config('log file is not writable: ' + log_file)
22
+ end
19
23
  @logger.subscribe(Cabin::Outputs::EmStdlibLogger.new(ruby_logger))
20
24
  @logger.level = options[:verbose] ? 'debug' : 'info'
21
25
  config_file = options[:config_file] || '/etc/sensu/config.json'
@@ -97,6 +101,9 @@ module Sensu
97
101
  opts.on('-c', '--config FILE', 'Sensu JSON config FILE (default: /etc/sensu/config.json)') do |file|
98
102
  options[:config_file] = file
99
103
  end
104
+ opts.on('-l', '--log FILE', 'Sensu log FILE (default: /tmp/sensu.log)') do |file|
105
+ options[:log_file] = file
106
+ end
100
107
  opts.on('-v', '--verbose', 'Enable verbose logging (default: false)') do
101
108
  options[:verbose] = true
102
109
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu
3
3
  version: !ruby/object:Gem::Version
4
- hash: 53
4
+ hash: 51
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 8
9
- - 5
10
- version: 0.8.5
9
+ - 6
10
+ version: 0.8.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sean Porter