Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
[email protected] web/email now available. Want one? Go here.
Cannot use outlook/hotmail/live here to register as they blocking our mail servers. #microsoftdeez
Obey the Epel!

Paste

Pasted as Ruby by Nek ( 13 years ago )
# 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

 

Revise this Paste

Your Name: Code Language: