Class: PackageChanger::Log
- Inherits:
-
Object
- Object
- PackageChanger::Log
- Defined in:
- lib/PackageChanger/log.rb
Constant Summary collapse
- DEFAULT_FILE =
Pathname.new '/var/log/packagechanger.log'
- DATE_FORMAT =
date and line format
'%Y-%m-%d %H:%M:%S'
Instance Method Summary collapse
-
#initialize ⇒ Log
constructor
A new instance of Log.
- #putsandlog(message) ⇒ Object
- #write(message) ⇒ Object
Constructor Details
#initialize ⇒ Log
Returns a new instance of Log.
9 10 11 |
# File 'lib/PackageChanger/log.rb', line 9 def initialize File.write(DEFAULT_FILE, "≈≈≈ PackageChanger ≈≈≈\n", mode: 'a') unless (DEFAULT_FILE.file? && DEFAULT_FILE.writable?) end |
Instance Method Details
#putsandlog(message) ⇒ Object
17 18 19 20 |
# File 'lib/PackageChanger/log.rb', line 17 def putsandlog() puts write end |
#write(message) ⇒ Object
13 14 15 |
# File 'lib/PackageChanger/log.rb', line 13 def write() File.write(DEFAULT_FILE, "#{Time.now.strftime(DATE_FORMAT)} - #{}\n", mode: 'a') end |