Module: RG::Log
- Defined in:
- lib/rubygoods/log.rb
Class Method Summary collapse
- .crash(input, code = 1, ln = true, color = true) ⇒ Object
- .err(input, ln = true, color = true) ⇒ Object
- .warn(input, ln = true, color = true) ⇒ Object
- .write(input, ln = true, color = true) ⇒ Object
Class Method Details
.crash(input, code = 1, ln = true, color = true) ⇒ Object
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/rubygoods/log.rb', line 114 def self.crash(input, code=1, ln=true, color=true) msg = input.to_s datencstr = "%d.%m.%Y|%H:%M:%S" datestr = if color Rainbow("%d").magenta.underline + Rainbow(".").red.underline + Rainbow("%m").magenta.underline + Rainbow(".").red.underline + Rainbow("%Y").magenta.underline + Rainbow("|").red.underline + Rainbow("%H").magenta.underline + Rainbow(":").red.underline + Rainbow("%M").magenta.underline + Rainbow(":").red.underline + Rainbow("%S").magenta.underline else datencstr end date = DateTime.now.gregorian dateout = date.strftime datestr datencout = date.strftime datencstr out = if color Rainbow("[").red.underline + dateout + Rainbow("]").red.underline + Rainbow("CRASH> ").magenta.underline + msg else "[" + datencout + "]CRASH>" + " " + msg end if ln puts out else print out end Kernel.exit(code) end |
.err(input, ln = true, color = true) ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/rubygoods/log.rb', line 78 def self.err(input, ln=true, color=true) msg = input.to_s datencstr = "%d.%m.%Y|%H:%M:%S" datestr = if color Rainbow("%d").red.underline + Rainbow(".").orange.underline + Rainbow("%m").red.underline + Rainbow(".").orange.underline + Rainbow("%Y").red.underline + Rainbow("|").orange.underline + Rainbow("%H").red.underline + Rainbow(":").orange.underline + Rainbow("%M").red.underline + Rainbow(":").orange.underline + Rainbow("%S").red.underline else datencstr end date = DateTime.now.gregorian dateout = date.strftime datestr datencout = date.strftime datencstr out = if color Rainbow("[").orange.underline + dateout + Rainbow("]").orange.underline + Rainbow("ERR> ").red.underline + msg else "[" + datencout + "]ERR> " + msg end if ln puts out else print out end return "[" + datencout + "]ERR>" + " " + msg end |
.warn(input, ln = true, color = true) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/rubygoods/log.rb', line 42 def self.warn(input, ln=true, color=true) msg = input.to_s datencstr = "%d.%m.%Y|%H:%M:%S" datestr = if color Rainbow("%d").orange.underline + Rainbow(".").red.underline + Rainbow("%m").orange.underline + Rainbow(".").red.underline + Rainbow("%Y").orange.underline + Rainbow("|").red.underline + Rainbow("%H").orange.underline + Rainbow(":").red.underline + Rainbow("%M").orange.underline + Rainbow(":").red.underline + Rainbow("%S").orange.underline else datencstr end date = DateTime.now.gregorian dateout = date.strftime datestr datencout = date.strftime datencstr out = if color Rainbow("[").red.underline + dateout + Rainbow("]").red.underline + Rainbow("WARN> ").orange.underline + msg else "[" + datencout + "]WARN>" + " " + msg end if ln puts out else print out end return "[" + datencout + "]WARN>" + " " + msg end |
.write(input, ln = true, color = true) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/rubygoods/log.rb', line 6 def self.write(input, ln=true, color=true) msg = input.to_s datencstr = "%d.%m.%Y|%H:%M:%S" datestr = if color Rainbow("%d").green.underline + Rainbow(".").cyan.underline + Rainbow("%m").green.underline + Rainbow(".").cyan.underline + Rainbow("%Y").green.underline + Rainbow("|").cyan.underline + Rainbow("%H").green.underline + Rainbow(":").cyan.underline + Rainbow("%M").green.underline + Rainbow(":").cyan.underline + Rainbow("%S").green.underline else datencstr end date = DateTime.now.gregorian dateout = date.strftime datestr datencout = date.strftime datencstr out = if color Rainbow("[").cyan.underline + dateout + Rainbow("]").cyan.underline + Rainbow("-> ").green.underline + msg else "[" + datencout + "]-> " + msg end if ln puts out else print out end return "[" + datencout + "]->" + " " + msg end |