trivial_log_formatter 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 27a073c067bab40211de20d6f4c9d078c8983da8
4
- data.tar.gz: d772185f6158ae4927f03e09cdf0c92a4ecba712
3
+ metadata.gz: b2bc3bea213041b469b757ffe0e2504f97c9f179
4
+ data.tar.gz: e864321098959873c9671e8460eef066debb64ca
5
5
  SHA512:
6
- metadata.gz: 4a9600236daaafd71f090df958ed453d72323736c81b5dbd459da9d44bc8f8ea3942046dbba792a2ed60ed73db5c36b42a3cd682d8af26511a1ab42ccf44c290
7
- data.tar.gz: c00eec69484906292f0e03af86182483121957118bfa717ceff370b3adfb1fe2fa519205b7faf86d7321b31ff96f78edba64d6cf3b4d9ce6b10bee9910341794
6
+ metadata.gz: 75b37ab9de4605a7047d9de7f5f87431942031a7bdac2f7fda3b4211047cd6a7fd4fa6919e92d5b5add3d016b220a3f1c435e6e6e6e8cbf2413728dbccc98834
7
+ data.tar.gz: e7d26a9d1f4beedbc5ab05827283f8f7cd023d939c556fd0ffcb9bd498b176699f1f7041b292fc344290533f6d4e8ee3b9e7ff8a293ec4149f4f120819bdcd0c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- trivial_log_formatter (0.0.1)
4
+ trivial_log_formatter (0.0.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -4,10 +4,16 @@ require 'logger'
4
4
  module TrivialLogFormatter
5
5
 
6
6
  class Formatter < ::Logger::Formatter
7
- FORMAT = "[%s#%d] %5s -- %s: %s\n"
7
+ FORMAT = "\033[%sm[%s#%d] %5s -- %s: %s\033[0m\n"
8
+ SEVERITY_COLOR_MAP = {:debug => '0;37', :info => '32', :warn => '33', :error => '31', :fatal => '31', :unknown => '37'}
8
9
 
9
10
  def call(severity, time, progname, msg)
10
- FORMAT % [format_datetime(time), $$, severity, progname, msg2str(msg)]
11
+ msg = '' if msg.nil?
12
+ FORMAT % [severity_to_color(severity), format_datetime(time), $$, severity, progname, msg2str(msg)]
13
+ end
14
+
15
+ def severity_to_color(severity)
16
+ SEVERITY_COLOR_MAP[severity.downcase.to_sym]
11
17
  end
12
18
 
13
19
  end
@@ -1,3 +1,3 @@
1
1
  module TrivialLogFormatter
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trivial_log_formatter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erich N. Quintero
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-16 00:00:00.000000000 Z
11
+ date: 2014-09-25 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Based on Ruby's default formatter.
14
14
  email: contact@quintsys.com
@@ -48,7 +48,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
48
48
  version: '0'
49
49
  requirements: []
50
50
  rubyforge_project:
51
- rubygems_version: 2.2.2
51
+ rubygems_version: 2.4.1
52
52
  signing_key:
53
53
  specification_version: 4
54
54
  summary: Trivial log formatter.