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
707 708 709 710 |
# File 'lib/rubyhacks.rb', line 707 def self.clean_up return unless @@log_file File.delete @@log_file if FileTest.exist? @@log_file end |
.log(*messages) ⇒ Object
712 713 714 715 716 717 718 719 720 721 |
# File 'lib/rubyhacks.rb', line 712 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
699 700 701 |
# File 'lib/rubyhacks.rb', line 699 def self.log_file @@log_file end |
.log_file=(file) ⇒ Object
703 704 705 |
# File 'lib/rubyhacks.rb', line 703 def self.log_file=(file) @@log_file=file end |
.logf(func_name) ⇒ Object
728 729 730 |
# File 'lib/rubyhacks.rb', line 728 def Log.logf(func_name) log("Function: " + func_name + ": " + self.to_s) end |
Instance Method Details
#log(*messages) ⇒ Object
723 724 725 726 |
# File 'lib/rubyhacks.rb', line 723 def log(*) return nil unless @@log_file Log.log(*) end |
#logd ⇒ Object
770 771 772 |
# File 'lib/rubyhacks.rb', line 770 def logd log("Current Directory: " + Dir.pwd) end |
#logf(func_name) ⇒ Object
732 733 734 735 736 737 738 |
# File 'lib/rubyhacks.rb', line 732 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
740 741 742 743 744 745 746 |
# File 'lib/rubyhacks.rb', line 740 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
755 756 757 758 759 760 |
# File 'lib/rubyhacks.rb', line 755 def logi(*) return nil unless @@log_file .each do || File.open(@@log_file, 'a'){|file| file.puts .inspect} end end |
#logt ⇒ Object
762 763 764 |
# File 'lib/rubyhacks.rb', line 762 def logt log("Traceback \n" + caller.join("\n")) end |