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 +4 -4
- data/lib/logue/loggable.rb +17 -27
- data/lib/logue/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95cf55b9a46e87e0efde0c6dc8165b81589da57d
|
4
|
+
data.tar.gz: 72e63c79ecb54ced7592a2c29989a538fcb5da59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82e7dacd7ac3fb7abb70f5b1c2c11a50dd798c3b99d715e6123e3b6c67a84c60ee83eedfe0aea89b78baa773bdc1c851865a7dc61c190def8e82cc38d758eb26
|
7
|
+
data.tar.gz: 429aeb5c76d4144c8f1391812c600e8c9c4189532d84dc377a1006315de27718021d99cc1e36402e758cfe2f2745a9d69c36ba92d5e031e51b48fc865fac3d69
|
data/lib/logue/loggable.rb
CHANGED
@@ -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
|
-
|
45
|
-
|
46
|
-
|
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
|
-
|
63
|
-
|
64
|
-
|
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
|
-
|
70
|
-
|
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
|
-
|
74
|
-
|
75
|
-
|
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
|
data/lib/logue/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2019-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|