occi-core 4.2.8 → 4.2.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/occi/log.rb +15 -13
  3. data/lib/occi/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fe9f229bab5b1ec66e0bde20117f04809e49fc3c
4
- data.tar.gz: 6c198e622744e85891327bb44eb3c59768aef3d6
3
+ metadata.gz: 048de127a2481ac6c0fffea83b1c94f6823e8204
4
+ data.tar.gz: a3428c76af76ab77a58d8835ab9843c651c5ea1e
5
5
  SHA512:
6
- metadata.gz: 4d6db094b91ba1b68846a6fb2f750a5096c61d75e1a87392fa1eb1b7387cd5892b7b77d43a9a863425344167097e5c10fa61d17369f076ceb3fd570e652c448e
7
- data.tar.gz: def0771cdaa027734d13cdb23155da859d157fa0ef40eaf2741896eb0e782cb3d5af1aac453e3f9db792423da51ae692e54b432de9dc215593cce49281a90423
6
+ metadata.gz: cc0813f8ebfbacbabd56be0c9dd01fc30ed29c21c966c53c2b534e3d5b6436e8693337d3a1d5421a5e91bf8311ea0d03e00f559c73d36196fa1cd485a2b49b05
7
+ data.tar.gz: 4ccef9118f96d9e260f42a7b3101e719b2d9498d88236893eb63f3f09f5f64d4a8111609e8dc71f54e918464fc313d620fecb345eaf04065eb625b3dcabeebfc
data/lib/occi/log.rb CHANGED
@@ -7,21 +7,23 @@ module Occi
7
7
 
8
8
  attr_reader :logger, :log_prefix
9
9
 
10
+ SUBSCRIPTION_HANDLE = "rOCCI-core.log"
11
+
10
12
  # creates a new OCCI logger
11
- # @param [IO,String] log_dev The log device. This is a filename (String) or IO object (typically +STDOUT+,
12
- # @param [String] log_prefix String placed in front of every logged message
13
+ # @param log_dev [IO,String] The log device. This is a filename (String) or IO object (typically +STDOUT+,
14
+ # @param log_prefix [String] String placed in front of every logged message
13
15
  # +STDERR+, or an open file).
14
16
  def initialize(log_dev, log_prefix = '[rOCCI-core]')
15
- if log_dev.kind_of? Logger
17
+ if log_dev.kind_of? ::Logger
16
18
  @logger = log_dev
17
19
  else
18
- @logger = Logger.new(log_dev)
20
+ @logger = ::Logger.new(log_dev)
19
21
  end
20
22
 
21
23
  @log_prefix = log_prefix.blank? ? '' : log_prefix.strip
22
24
 
23
25
  # subscribe to log messages and send to logger
24
- @log_subscriber = ActiveSupport::Notifications.subscribe("rOCCI-core.log") do |name, start, finish, id, payload|
26
+ @log_subscriber = ActiveSupport::Notifications.subscribe(self.class::SUBSCRIPTION_HANDLE) do |name, start, finish, id, payload|
25
27
  @logger.log(payload[:level], "#{@log_prefix} #{payload[:message]}") if @logger
26
28
  end
27
29
  end
@@ -30,40 +32,40 @@ module Occi
30
32
  ActiveSupport::Notifications.unsubscribe(@log_subscriber)
31
33
  end
32
34
 
33
- # @param [Logger::Severity] severity
35
+ # @param severity [::Logger::Severity] severity
34
36
  def level=(severity)
35
37
  @logger.level = severity
36
38
  end
37
39
 
38
- # @return [Logger::Severity]
40
+ # @return [::Logger::Severity]
39
41
  def level
40
42
  @logger.level
41
43
  end
42
44
 
43
45
  # @see info
44
46
  def self.debug(message)
45
- ActiveSupport::Notifications.instrument("rOCCI-core.log", :level => Logger::DEBUG, :message => message)
47
+ ActiveSupport::Notifications.instrument(self::SUBSCRIPTION_HANDLE, :level => ::Logger::DEBUG, :message => message)
46
48
  end
47
49
 
48
50
  # Log an +INFO+ message
49
- # @param [String] message the message to log; does not need to be a String
51
+ # @param message [String] message the message to log; does not need to be a String
50
52
  def self.info(message)
51
- ActiveSupport::Notifications.instrument("rOCCI-core.log", :level => Logger::INFO, :message => message)
53
+ ActiveSupport::Notifications.instrument(self::SUBSCRIPTION_HANDLE, :level => ::Logger::INFO, :message => message)
52
54
  end
53
55
 
54
56
  # @see info
55
57
  def self.warn(message)
56
- ActiveSupport::Notifications.instrument("rOCCI-core.log", :level => Logger::WARN, :message => message)
58
+ ActiveSupport::Notifications.instrument(self::SUBSCRIPTION_HANDLE, :level => ::Logger::WARN, :message => message)
57
59
  end
58
60
 
59
61
  # @see info
60
62
  def self.error(message)
61
- ActiveSupport::Notifications.instrument("rOCCI-core.log", :level => Logger::ERROR, :message => message)
63
+ ActiveSupport::Notifications.instrument(self::SUBSCRIPTION_HANDLE, :level => ::Logger::ERROR, :message => message)
62
64
  end
63
65
 
64
66
  # @see info
65
67
  def self.fatal(message)
66
- ActiveSupport::Notifications.instrument("rOCCI-core.log", :level => Logger::FATAL, :message => message)
68
+ ActiveSupport::Notifications.instrument(self::SUBSCRIPTION_HANDLE, :level => ::Logger::FATAL, :message => message)
67
69
  end
68
70
  end
69
71
  end
data/lib/occi/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Occi
2
- VERSION = "4.2.8" unless defined?(::Occi::VERSION)
2
+ VERSION = "4.2.9" unless defined?(::Occi::VERSION)
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: occi-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.8
4
+ version: 4.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Feldhaus
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-02-08 00:00:00.000000000 Z
13
+ date: 2014-02-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json