Module: Log
- Defined in:
- lib/rubyhacks.rb
Constant Summary collapse
- @@log_file =
'log.txt'
Class Method Summary collapse
- .clean_up ⇒ Object
- .log(*messages) ⇒ Object
- .log_file ⇒ Object
- .log_file=(file) ⇒ Object
- .logf(func_name) ⇒ Object
- .logi(*messages) ⇒ Object
- .logt ⇒ Object
Instance Method Summary collapse
- #log(*messages) ⇒ Object
- #logd ⇒ Object
- #logf(func_name) ⇒ Object
- #logfc(func_name) ⇒ Object
- #logi(*messages) ⇒ Object
- #logt ⇒ Object
Class Method Details
.clean_up ⇒ Object
696 697 698 699 |
# File 'lib/rubyhacks.rb', line 696 def self.clean_up return unless @@log_file File.delete @@log_file if FileTest.exist? @@log_file end |
.log(*messages) ⇒ Object
701 702 703 704 705 706 707 708 709 710 |
# File 'lib/rubyhacks.rb', line 701 def Log.log(*) # p 'wanting to log', @@log_file return nil unless @@log_file # return # return unless @@log_file # puts 'logging' .each do || File.open(@@log_file, 'a'){|file| file.puts } end end |
.log_file ⇒ Object
688 689 690 |
# File 'lib/rubyhacks.rb', line 688 def self.log_file @@log_file end |
.log_file=(file) ⇒ Object
692 693 694 |
# File 'lib/rubyhacks.rb', line 692 def self.log_file=(file) @@log_file=file end |
.logf(func_name) ⇒ Object
717 718 719 |
# File 'lib/rubyhacks.rb', line 717 def Log.logf(func_name) log("Function: " + func_name + ": " + self.to_s) end |
Instance Method Details
#log(*messages) ⇒ Object
712 713 714 715 |
# File 'lib/rubyhacks.rb', line 712 def log(*) return nil unless @@log_file Log.log(*) end |
#logd ⇒ Object
759 760 761 |
# File 'lib/rubyhacks.rb', line 759 def logd log("Current Directory: " + Dir.pwd) end |
#logf(func_name) ⇒ Object
721 722 723 724 725 726 727 |
# File 'lib/rubyhacks.rb', line 721 def logf(func_name) # p func_name # p "Function: " + func_name.to_s + ": " + self.class.to_s = "Function: " + func_name.to_s + ": " + self.class.to_s # p message.class log() end |
#logfc(func_name) ⇒ Object
729 730 731 732 733 734 735 |
# File 'lib/rubyhacks.rb', line 729 def logfc(func_name) # p func_name # p "Function: " + func_name.to_s + ": " + self.class.to_s = "Function: " + func_name.to_s + ": complete :" + self.class.to_s # p message.class log() end |
#logi(*messages) ⇒ Object
744 745 746 747 748 749 |
# File 'lib/rubyhacks.rb', line 744 def logi(*) return nil unless @@log_file .each do || File.open(@@log_file, 'a'){|file| file.puts .inspect} end end |
#logt ⇒ Object
751 752 753 |
# File 'lib/rubyhacks.rb', line 751 def logt log("Traceback \n" + caller.join("\n")) end |