Class: Fabric::FabricLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/fabric/fabric_logger.rb

Constant Summary collapse

LOGGER_TAG =
'HYPERLEDGER FABRIC'.freeze
FILTERED_MASK =
'[FILTERED]'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(logger, filters = []) ⇒ FabricLogger

Returns a new instance of FabricLogger.



8
9
10
11
# File 'lib/fabric/fabric_logger.rb', line 8

def initialize(logger, filters = [])
  @logger = logger
  @filters = [filters].compact
end

Instance Attribute Details

#filtersObject (readonly)

Returns the value of attribute filters.



6
7
8
# File 'lib/fabric/fabric_logger.rb', line 6

def filters
  @filters
end

#loggerObject (readonly)

Returns the value of attribute logger.



6
7
8
# File 'lib/fabric/fabric_logger.rb', line 6

def logger
  @logger
end

Instance Method Details

#debug(*args) ⇒ Object



25
26
27
28
29
# File 'lib/fabric/fabric_logger.rb', line 25

def debug(*args)
  return unless logger

  logger.debug filter_message(args.join('|'))
end

#error(*args) ⇒ Object



13
14
15
16
17
# File 'lib/fabric/fabric_logger.rb', line 13

def error(*args)
  return unless logger

  logger.error filter_message(args.join('|'))
end

#info(*args) ⇒ Object



19
20
21
22
23
# File 'lib/fabric/fabric_logger.rb', line 19

def info(*args)
  return unless logger

  logger.info filter_message(args.join('|'))
end