Method: Worldline::Acquiring::SDK::Logging::RubyCommunicatorLogger.create_logfile

Defined in:
lib/worldline/acquiring/sdk/logging/ruby_communicator_logger.rb

.create_logfile(filename) ⇒ Object

Opens or creates a new file in write-only mode with filename.



40
41
42
43
44
45
46
47
48
49
# File 'lib/worldline/acquiring/sdk/logging/ruby_communicator_logger.rb', line 40

def self.create_logfile(filename)
  logdev = begin
             open(filename, (File::WRONLY | File::APPEND | File::CREAT | File::EXCL))
           rescue Errno::EEXIST
             # file is created by another process
             open_logfile(filename)
           end
  logdev.sync = true
  logdev
end