Class: Blooper::Application
- Inherits:
-
Logger::Application
- Object
- Logger::Application
- Blooper::Application
- Defined in:
- lib/blooper.rb
Constant Summary collapse
- DATE_FORMAT =
'%Y/%m/%d %H:%M:%S'
- LOGGER_LEVEL =
Logger::INFO
Instance Method Summary collapse
-
#initialize ⇒ Application
constructor
A new instance of Application.
- #run ⇒ Object
Constructor Details
#initialize ⇒ Application
Returns a new instance of Application.
24 25 26 27 28 |
# File 'lib/blooper.rb', line 24 def initialize super('Blooper') self.level = $VERBOSE && Logger::DEBUG || LOGGER_LEVEL self.logger.formatter = formatter end |
Instance Method Details
#run ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/blooper.rb', line 30 def run @log.info('Establishing the database connection') DB.instance @log.info('A database connection has been established') Input.each do |tuple| begin tuple.save @log.debug('Data was saved') rescue Sequel::DatabaseDisconnectError @log.warn('A database connection has been lost, reconnecting...') DB.instance.connect retry rescue Sequel::Error => error @log.error(error..gsub(/\n.*/s, '')) next end end end |