Module: ISO8583::MKB::Logging

Defined in:
lib/iso8583-mkb/logging.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.loggerObject (readonly)

Returns the value of attribute logger.



26
27
28
# File 'lib/iso8583-mkb/logging.rb', line 26

def logger
  @logger
end

Class Method Details

.message(message) ⇒ Object



22
23
24
# File 'lib/iso8583-mkb/logging.rb', line 22

def message(message)
  message.to_s.split("\n").each(&@logger.method(:debug))
end

.start(logfile = nil) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/iso8583-mkb/logging.rb', line 8

def start(logfile = nil)
  logfile = STDERR if logfile.nil?

  if logfile.kind_of?(Logger)
    @logger = logfile
  else
    @logger = Logger.new logfile, :daily
  end
end

.started?Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/iso8583-mkb/logging.rb', line 4

def started?
  !@logger.nil?
end

.stopObject



18
19
20
# File 'lib/iso8583-mkb/logging.rb', line 18

def stop
  @logger = nil
end