Sha256: a9f56fa4338d9104298d2cdd90053cba993bb7b23bec74a5b0c1b53a530f6a8d

Contents?: true

Size: 460 Bytes

Versions: 2

Compression:

Stored size: 460 Bytes

Contents

# frozen_string_literal: true

# This modules helps to write into the log file
# Usage:
#   include PhNoToWord::Logger
#   def do_something
#     begin
#       # do something
#     rescue StandardError => e
#       log :error, e.message
#     end
#   end
module PhNoToWord
  module Logger
    # Log a PhNoToWord-specific line.
    def log(level, message)
      File.open('log.txt', 'a') do |f|
        f.write "#{level}: #{message}"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ph_no_to_word-2.0.0 lib/ph_no_to_word/logger.rb
ph_no_to_word-1.0.0 lib/ph_no_to_word/logger.rb