Sha256: 0dc535bfd5aa0ab97f3e420245b0d23df32a76407a06de003619b364c8bc984a
Contents?: true
Size: 669 Bytes
Versions: 9
Compression:
Stored size: 669 Bytes
Contents
# Logger Formatter mit Timestamp und in Farbe # übernommen von hier: https://cbpowell.wordpress.com/2013/08/09/beautiful-logging-for-ruby-on-rails-4 # class ActiveSupport::Logger::SimpleFormatter SEVERITY_TO_COLOR_MAP = { 'DEBUG'=>'0;37', 'INFO'=>'32', 'WARN'=>'33', 'ERROR'=>'31', 'FATAL'=>'31', 'UNKNOWN'=>'37' } def call(severity, time, progname, msg) formatted_severity = sprintf("%-5s",severity) formatted_time = time.strftime("%d.%m.%Y %H:%M:%S.") << time.usec.to_s[0..2].rjust(3) color = SEVERITY_TO_COLOR_MAP[severity] "\033[0;37m#{formatted_time}\033[0m [\033[#{color}m#{formatted_severity}\033[0m] #{msg.strip} (pid:#{$$})\n" end end
Version data entries
9 entries across 9 versions & 1 rubygems