Created
August 14, 2016 14:57
Logger issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# version 0.0 | |
# Schedules cronjob and parses setup.txt. Prepares the program for | |
# operation. | |
require 'time' | |
require 'logger' | |
# Contains all necessary setup methods. | |
class Setup | |
# initialises logger, runs read and cron methods. | |
def initialize | |
logger = Logger.new('logfile.log') | |
logger.level = 'DEBUG' | |
logger.datetime_format = '%Y-%m-%d %H:%M:%S' | |
self.read | |
self.schedule_cronjob | |
end | |
# Reads setup.txt to parse input email. | |
def read | |
open("setup.txt") {|s| | |
logger.info { 'setup.txt successfully loaded.' } | |
data = s.readlines | |
@email = data[1] | |
logger.info { 'Email successfully parsed as :' + email } | |
} | |
puts 'Reading email: ' + @email | |
end | |
# Schedules cronjob for app to run daily. | |
def schedule_cronjob | |
end | |
end | |
# Main loop | |
def main | |
puts 'Commencing setup...' | |
setup = Setup.new | |
puts 'Setup completed successfully. Check logs for more info.' | |
end | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment