bmc-daemon-lib 0.13.5 → 0.14.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a9b0c4e7c2f8b8e61d4b82cbd950553375ff7a889551a53ab4dbaa6399e68500
4
- data.tar.gz: 7c99b5d8d6476ef5680f0f803acbd79e1837dd549f53745cb650b9785a68f365
3
+ metadata.gz: 95584e4825ec5689ee4b524266ea2e2f924cc3bba32fe79d04d37d5e0ad668bf
4
+ data.tar.gz: 95147b1684cf98add39341fcb794408c936440acecf58088a00f57dc594456d0
5
5
  SHA512:
6
- metadata.gz: 3df22c7367123552cf02ce1a1f3eda96670b22c42dcdd40fc479d3eaac368ee9782ea45797f92d09aae3cfc0f735fe0608511e8684a9a6e3e48302546ad8ef84
7
- data.tar.gz: f48869aa809007a6f20a4957eebb423b98e5ab515118056162b6a1866107bb9976268ad99b9bff81d95ad99eaab3215a0c1c01235d5f5324d1fa4f24c8e776a8
6
+ metadata.gz: 01dcad1a0954f8de9e5d621447c48d27446ab26891e1561c3c65df79c801b69246c34a3bcab9383d76550ebb30202db7c700b4757c8002e850457f719a4b29b8
7
+ data.tar.gz: a9243531dbb76d338bb55fd7009be295f630d08eb44361f3448d0fe260dcdba073bf60b0b5d0241ebee479cd69c5afb873a3e2c4425c710fa440ea73b5248bba
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  Gem::Specification.new do |spec|
3
3
  # Project version
4
- spec.version = "0.13.5"
4
+ spec.version = "0.14.0"
5
5
 
6
6
  # Project description
7
7
  spec.name = "bmc-daemon-lib"
@@ -63,6 +63,9 @@ module BmcDaemonLib
63
63
  # Read the gemspec
64
64
  gemspec = init_from_gemspec
65
65
 
66
+ # Annnounce loaded context
67
+ log_conf "initialized [#{@app_name}] version [#{@app_ver}]"
68
+
66
69
  #return gemspec
67
70
  return @app_root
68
71
  end
@@ -72,9 +75,9 @@ module BmcDaemonLib
72
75
  end
73
76
 
74
77
  def dump_to_logs
75
- self.log :conf, "configuration dump"
78
+ log_conf "configuration dump"
76
79
  dump.lines.each do |line|
77
- self.log :conf, "| #{line.rstrip}"
80
+ log_conf "| #{line.rstrip}"
78
81
  end
79
82
  end
80
83
 
@@ -92,20 +95,20 @@ module BmcDaemonLib
92
95
  if ::File.exists?(logfile)
93
96
  # File is there, is it writable ?
94
97
  unless ::File.writable?(logfile)
95
- log :conf, "logging [#{pipe}] disabled: file not writable [#{logfile}]"
98
+ log_conf "logging [#{pipe}] disabled: file not writable [#{logfile}]"
96
99
  return nil
97
100
  end
98
101
  else
99
102
  # No file here, can we create it ?
100
103
  logdir = ::File.dirname(logfile)
101
104
  unless ::File.writable?(logdir)
102
- log :conf, "logging [#{pipe}] disabled: directory not writable [#{logdir}]"
105
+ log_conf "logging [#{pipe}] disabled: directory not writable [#{logdir}]"
103
106
  return nil
104
107
  end
105
108
  end
106
109
 
107
110
  # OK, return a clean file path
108
- log :conf, "logging [#{pipe}] to [#{logfile}]"
111
+ log_conf "logging [#{pipe}] to [#{logfile}]"
109
112
  return logfile
110
113
  end
111
114
 
@@ -182,7 +185,7 @@ module BmcDaemonLib
182
185
  return unless self.feature?(:newrelic)
183
186
 
184
187
  # Ok, let's start
185
- log :conf, "prepare NewRelic"
188
+ log_conf "prepare NewRelic"
186
189
  conf = self[:newrelic]
187
190
 
188
191
  # Enable GC profiler
@@ -208,7 +211,7 @@ module BmcDaemonLib
208
211
  end
209
212
 
210
213
  # Ok, let's start
211
- log :conf, "prepare Rollbar"
214
+ log_conf "prepare Rollbar"
212
215
  conf = self[:rollbar]
213
216
 
214
217
  # Configure
@@ -239,7 +242,7 @@ module BmcDaemonLib
239
242
 
240
243
  # Reload config
241
244
  # puts "Conf.reload: loading files: #{files.inspect}"
242
- log :conf, "reloading from files: #{files.inspect}"
245
+ log_conf "loading configuration from: #{files.inspect}"
243
246
  load files: files, namespaces: { environment: @app_env }
244
247
 
245
248
  # Try to access any key to force parsing of the files
@@ -253,12 +256,16 @@ module BmcDaemonLib
253
256
  return to_hash
254
257
  end
255
258
 
259
+ def log_conf msg
260
+ self.log :conf, msg
261
+ end
262
+
256
263
  def log origin, message
257
264
  printf(
258
265
  "%s %-14s %s \n",
259
266
  Time.now.strftime("%Y-%m-%d %H:%M:%S"),
260
- origin,
261
- message
267
+ origin.to_s,
268
+ message.to_s
262
269
  )
263
270
  end
264
271
 
@@ -317,7 +324,7 @@ module BmcDaemonLib
317
324
  # Check if Chamber's behaviour may cause problems with hyphens
318
325
  basename = ::File.basename(path)
319
326
  if basename.include?'-'
320
- log :conf, "WARNING: files with dashes may cause unexpected behaviour with Chamber (#{basename})"
327
+ log_conf "WARNING: files with dashes may cause unexpected behaviour with Chamber (#{basename})"
321
328
  end
322
329
 
323
330
  # Add it
@@ -335,7 +342,7 @@ module BmcDaemonLib
335
342
 
336
343
  # Fallback on default path if not provided,
337
344
  specific ||= default
338
- specific ||= "default.log"
345
+ specific ||= "log/default.log"
339
346
 
340
347
  # Build logfile_path
341
348
  ::File.expand_path specific.to_s, path.to_s
@@ -352,7 +359,7 @@ module BmcDaemonLib
352
359
  next unless arg.to_s.empty?
353
360
 
354
361
  # Otherise, we just exit
355
- log :conf, "FAILED: object Conf has not been initialized correctly yet"
362
+ log_conf "FAILED: object Conf has not been initialized correctly yet"
356
363
  exit 200
357
364
  end
358
365
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bmc-daemon-lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.5
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno MEDICI
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-03 00:00:00.000000000 Z
11
+ date: 2019-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler