bmc-daemon-lib 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6003c5c0de9402b624030ffc916167fe5d220286
4
- data.tar.gz: 98df2f514f440a1a8ef06915cfb0aaddbd172a7c
3
+ metadata.gz: 717e62be1cf40cba5d185e3b874bf118ad484f16
4
+ data.tar.gz: 8e7009af53b97eccda6ad9a6b9b4908d97a571a9
5
5
  SHA512:
6
- metadata.gz: 4c583268f6fb0e802a5ff8c4ea47ec8fa4ef34534cc14b92be74cda70bcc892cab263f35898d0efef32809a6694a891b18008142ede3d29fee09c470192ab994
7
- data.tar.gz: 595ad7d343c8880c992e2b4701f079e841205ebe0ae792ecac836a8c5b368dd13501ed0ca508b8821298f9d4f5230654b0d198e0545943c7a035007303a53236
6
+ metadata.gz: e8298d97416782976d686687db0ecb799a86a7541ce3c69e88b8e4248e96556c1c3d2980a50d72e0638b4487c8ff2c996734e071bbad40a138dae08bb7121e80
7
+ data.tar.gz: 902afa597271e91c5debdbf87a86e7cede27c5b1d13adbcd079cda992734746be61edf47041401321ac66d3792e52e82f41ff838e49d012eb61b788b40da3c33
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bmc-daemon-lib (0.4.0)
5
- chamber (~> 2.9)
4
+ bmc-daemon-lib (0.4.1)
5
+ chamber (~> 2.9.1)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
@@ -33,7 +33,7 @@ PLATFORMS
33
33
 
34
34
  DEPENDENCIES
35
35
  bmc-daemon-lib!
36
- bundler (~> 1.6)
36
+ bundler
37
37
  rake
38
38
  rspec
39
39
 
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  Gem::Specification.new do |spec|
3
3
  # Project version
4
- spec.version = "0.4.0"
4
+ spec.version = "0.4.1"
5
5
 
6
6
  # Project description
7
7
  spec.name = "bmc-daemon-lib"
@@ -20,10 +20,10 @@ Gem::Specification.new do |spec|
20
20
  spec.required_ruby_version = ">= 2.2.2"
21
21
 
22
22
  # Development dependencies
23
- spec.add_development_dependency "bundler", "~> 1.6"
23
+ spec.add_development_dependency "bundler"
24
24
  spec.add_development_dependency "rake"
25
25
  spec.add_development_dependency "rspec"
26
26
 
27
27
  # Runtime dependencies
28
- spec.add_runtime_dependency "chamber", "~> 2.9"
28
+ spec.add_runtime_dependency "chamber" , "~> 2.9.1"
29
29
  end
@@ -2,17 +2,15 @@ require "logger"
2
2
 
3
3
  module BmcDaemonLib
4
4
  module LoggerHelper
5
- # Use accessor to expose logger to Grape, who uses .logger
5
+ # Use accessor to expose logger to Grape, as it uses logger.*
6
6
  attr_accessor :logger
7
7
 
8
8
  protected
9
9
 
10
10
  def log_pipe pipe, caller = nil
11
11
  @log_pipe = pipe
12
- @logger = BmcDaemonLib::LoggerPool.instance.get pipe
12
+ @logger = BmcDaemonLib::LoggerPool.instance.get(pipe)
13
13
  @caller = caller
14
- #Conf.log "log #{@log_pipe}", "log_to pipe: #{pipe} logger class: #{@logger.class}"
15
- #return @logger
16
14
  end
17
15
 
18
16
  def log_context
@@ -20,36 +18,41 @@ module BmcDaemonLib
20
18
  end
21
19
 
22
20
  def log_info message, details = nil
23
- logger.add Logger::INFO, message, get_full_context, details
21
+ log Logger::INFO, message, details
24
22
  end
25
23
  def log_error message, details = nil
26
- logger.add Logger::ERROR, message, get_full_context, details
24
+ log Logger::ERROR, message, details
27
25
  end
28
26
  def log_debug message, details = nil
29
- logger.add Logger::DEBUG, message, get_full_context, details
27
+ log Logger::DEBUG, message, details
30
28
  end
31
29
 
32
30
  private
33
31
 
34
- def get_full_context
35
- context = nil
32
+ def log severity, message, details
33
+ return puts "LoggerHelper.log: missing logger (#{get_class_name})" unless logger
34
+ # puts "LoggerHelper.log > #{message}"
35
+ # puts "LoggerHelper.log > #{get_full_context.inspect}"
36
+ logger.add severity, message, get_full_context, details
37
+ end
36
38
 
39
+ def get_full_context
37
40
  # Grab the classe's context
38
- context = log_context() if self.respond_to?(:log_context)
41
+ context = log_context()
39
42
 
40
43
  # Initialize an empty context, if log_context returned something else, or it the method was not exposed
41
44
  context = {} unless context.is_a? Hash
42
45
 
43
46
  # Who is the caller? Guess it from caller's class name if not provided
44
- context[:caller] ||= self.class.name.to_s.split('::').last
47
+ context[:caller] ||= get_class_name
45
48
 
46
49
  # Return the whole context
47
50
  return context
48
51
  end
49
52
 
50
- # alias info log_info
51
- # alias error log_error
52
- # alias debug log_debug
53
+ def get_class_name
54
+ self.class.name.to_s.split('::').last
55
+ end
53
56
 
54
57
  end
55
58
  end
@@ -9,7 +9,7 @@ module BmcDaemonLib
9
9
  def initialize wid, pool = nil
10
10
  # Logger
11
11
  # FIXME log_pipe
12
- @logger = LoggerPool.instance.get :workers
12
+ log_pipe :workers
13
13
  @log_worker_status_changes = true
14
14
 
15
15
  # Configuration
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bmc-daemon-lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno MEDICI
@@ -14,16 +14,16 @@ dependencies:
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.6'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.6'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '2.9'
61
+ version: 2.9.1
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '2.9'
68
+ version: 2.9.1
69
69
  description: 'Shared utilities to build a daemon: logger, configuration, helpers'
70
70
  email: bmc-daemon-lib@bmconseil.com
71
71
  executables: []