logue 1.0.17 → 1.0.18

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: b671b9df57340513c1edce589383f0ce1967d491
4
- data.tar.gz: 3be312075b7af0ad21fe4cbbea7b7aee1a648fc1
3
+ metadata.gz: 95cf55b9a46e87e0efde0c6dc8165b81589da57d
4
+ data.tar.gz: 72e63c79ecb54ced7592a2c29989a538fcb5da59
5
5
  SHA512:
6
- metadata.gz: d66088f3ab49047f2a357e2fb972f2f7d000eefa90e8e78d103c28b9ba1075ea5e82220eb79359d9e9251d6bec41cb999cca9dde260acf2b4b54cdcc29f12a35
7
- data.tar.gz: 38ec5e6d5f34a7dfd6edcd8fbe3fbe527b339c94acdd9b7e5f8e9a55e4f16e74b0211c5f70b613fc6da68dfc26ab03351fa13a685a3ce65c035d4570234e29c8
6
+ metadata.gz: 82e7dacd7ac3fb7abb70f5b1c2c11a50dd798c3b99d715e6123e3b6c67a84c60ee83eedfe0aea89b78baa773bdc1c851865a7dc61c190def8e82cc38d758eb26
7
+ data.tar.gz: 429aeb5c76d4144c8f1391812c600e8c9c4189532d84dc377a1006315de27718021d99cc1e36402e758cfe2f2745a9d69c36ba92d5e031e51b48fc865fac3d69
@@ -37,42 +37,32 @@ require 'logue/colorlog'
37
37
  # stack "my message"
38
38
  #
39
39
  # That will produce a stack trace from the given location.
40
- #
40
+ #
41
41
 
42
42
  module Logue
43
43
  module Loggable
44
- class << self
45
- def add_delegator with_level, methnames
46
- methnames.each do |methname|
47
- lines = Array.new.tap do |a|
48
- if with_level
49
- a << "def #{methname} msg = '', obj = nil, level = Level::DEBUG, &blk"
50
- a << " logger.send :#{methname}, msg, obj, level: level, classname: self.class.to_s, &blk"
51
- else
52
- a << "def #{methname} msg = '', obj = nil, &blk"
53
- a << " logger.send :#{methname}, msg, obj, classname: self.class.to_s, &blk"
54
- end
55
- a << "end"
56
- end
57
-
58
- class_eval lines.join("\n")
59
- end
60
- end
44
+ def logger
45
+ @logger ||= Log.logger
46
+ end
61
47
 
62
- def add_color_methods colors
63
- colors.each do |color, code|
64
- class_eval ColorLog.color_method_source(color, code)
65
- end
48
+ [ :stack, :log ].each do |methname|
49
+ define_method methname do |msg = '', obj = nil, level = Level::DEBUG, &blk|
50
+ logger.send methname, msg, obj, level: level, classname: self.class.to_s, &blk
66
51
  end
67
52
  end
68
53
 
69
- def logger
70
- @logger ||= Log.logger
54
+ [ :debug, :info, :warn, :error, :fatal, :write ].each do |methname|
55
+ define_method methname do |msg = '', obj = nil, &blk|
56
+ logger.send methname, msg, obj, classname: self.class.to_s, &blk
57
+ end
71
58
  end
72
59
 
73
- add_delegator true, [ :log, :stack ]
74
- add_delegator false, [ :debug, :info, :warn, :error, :fatal, :write ]
75
- add_color_methods Rainbow::Color::Named::NAMES
60
+ Rainbow::Color::Named::NAMES.each do |color, code|
61
+ define_method color do |msg = '', obj = nil, level = Level::DEBUG, &blk|
62
+ colmsg = "\e[#{30 + code}m#{msg}\e[0m"
63
+ logger.log colmsg, obj, level: level, classname: self.class.to_s, &blk
64
+ end
65
+ end
76
66
 
77
67
  def logger= logger
78
68
  @logger = logger
@@ -2,5 +2,5 @@
2
2
  # -*- ruby -*-
3
3
 
4
4
  module Logue
5
- VERSION = '1.0.17'
5
+ VERSION = '1.0.18'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logue
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.17
4
+ version: 1.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Pace
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-06 00:00:00.000000000 Z
11
+ date: 2019-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler