Sha256: cb1e5d89b902c0856418d181326b089d514cccedd3cd1aff407191af780034f8
Contents?: true
Size: 954 Bytes
Versions: 9
Compression:
Stored size: 954 Bytes
Contents
# frozen_string_literal: true require 'singleton' require_relative 'version' # Display and log project messages class Logger include Singleton @attr_verbose = 'yes' def set_verbose(value) @attr_verbose = value end def self.verbose(msg) print msg if @attr_verbose == 'yes' @logfile&.write(msg) end def self.verboseln(msg) verbose(msg + "\n") end def log(msg) verbose(msg) end def logln(msg) verboseln(msg) end ## # Create or reset logfile def self.create(logpath, logname) @logfile = File.open(logpath, 'w') @logfile.write('=' * 50 + "\n") @logfile.write("Created by : #{Asker::NAME}") @logfile.write(" (version #{Asker::VERSION})\n") @logfile.write("File : #{logname}\n") @logfile.write("Time : #{Time.new}\n") @logfile.write("Author : David Vargas Ruiz\n") @logfile.write('=' * 50 + "\n\n") end def self.close @logfile.close end end
Version data entries
9 entries across 9 versions & 1 rubygems