wololo_formatter 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,4 +30,33 @@ module ActiveSupport
30
30
  end
31
31
  end
32
32
  end
33
+
34
+ # Rails 4
35
+ class Logger
36
+ class SimpleFormatter
37
+ def call(severity, time, progname, msg)
38
+ formatted_time = time.strftime("%Y-%m-%d %H:%M:%S.") << time.usec.to_s[0..2].rjust(3)
39
+ "#{severity_color severity} \033[0;37m#{formatted_time}\033[0m #{String === msg ? msg : msg.inspect} (pid:#{$$})\n"
40
+ end
41
+
42
+ private
43
+
44
+ def severity_color(severity)
45
+ case severity
46
+ when "DEBUG"
47
+ "\033[1;34;40m[DEBUG]\033[0m" # blue
48
+ when "INFO"
49
+ "\033[0;32;40m[INFO]\033[0m " # bold white
50
+ when "WARN"
51
+ "\033[0;33;40m[WARN]\033[0m " # bold yellow
52
+ when "ERROR"
53
+ "\033[1;31;40m[ERROR]\033[0m" # bold red
54
+ when "FATAL"
55
+ "\033[7;31;40m[FATAL]\033[0m" # bold black, red bg
56
+ else
57
+ "[#{severity}]" # none
58
+ end
59
+ end
60
+ end
61
+ end
33
62
  end
@@ -1,3 +1,3 @@
1
1
  module WololoFormatter
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wololo_formatter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-06 00:00:00.000000000 Z
12
+ date: 2013-07-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler