A program to read a Phidget IR sensor and log pull-ups with Fitbit's API
at master 23 lines 538 B view raw
1class Textfile < Loggerish 2 def self.args 3 [ 4 [ "--file", "-f", GetoptLong::REQUIRED_ARGUMENT, 5 "log to flat file <file>" ], 6 ] 7 end 8 9 def after_initialize 10 if @enabled = !!@parent.config["file"] 11 @parent.vputs "enabling plaintext logging module to " << 12 @parent.config["file"] 13 end 14 end 15 16 def log_pullup!(time) 17 File.open(@parent.config["file"], "a") do |f| 18 f.puts time.strftime("%Y-%m-%d %H:%M:%S") 19 end 20 21 @parent.vputs "logged to file " << @parent.config["file"] 22 end 23end