# Logger
# By Nek

class NekLogger
 def initialize
  @logs = ""
  ObjectSpace.define_finalizer(self, self.class.method(:save).to_proc)
 end
 def add line
  t = Time.now
  @logs += "[" + t.day.to_s + '-' + t.mon.to_s + '-' + t.year.to_s + " " + t.hour.to_s + ":" + t.min.to_s + ":" + t.sec.to_s + "]" + line + "\n"
 end
 def save
  f = File.open('logs.txt');
  f.puts @logs
 end
end

Add a code snippet to your website: www.paste.org