logue 1.0.13 → 1.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/lib/logue/colorlog.rb +15 -10
- data/lib/logue/legacy_logger.rb +1 -1
- data/lib/logue/level.rb +2 -2
- data/lib/logue/line.rb +20 -3
- data/lib/logue/location.rb +4 -4
- data/lib/logue/location_format.rb +6 -19
- data/lib/logue/log.rb +39 -78
- data/lib/logue/loggable.rb +37 -40
- data/lib/logue/logger.rb +37 -34
- data/lib/logue/stack.rb +2 -1
- data/lib/logue/version.rb +1 -1
- data/lib/logue/writer.rb +3 -13
- metadata +3 -5
- data/lib/logue/colors.rb +0 -19
- data/lib/logue/severity.rb +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d93c0be8b98a96fa0f527a7fbf9ee887bc568152
|
4
|
+
data.tar.gz: e4e95e29c3e01b1a979c34abd12941508851435d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 610941e8a4c13e4a770fbc67ffa470091edf44ece9143bcce8bc0dc95c13e35571a16d87673194580755e57974933194a18665b52cd844c42dbfe150854b9ea1
|
7
|
+
data.tar.gz: 337d2cab1cedc557e65ddc9d2c7d7110dccbf0ba32382d2ae365c945dd67f5f446558ea7b71a8fbfa46d900cef844c2bc5a25e0e5cf47f5e14980c5c8451f545
|
data/README.md
CHANGED
data/lib/logue/colorlog.rb
CHANGED
@@ -26,9 +26,7 @@ require 'logue/level'
|
|
26
26
|
module Logue
|
27
27
|
module ColorLog
|
28
28
|
def method_missing meth, *args, &blk
|
29
|
-
|
30
|
-
validcolors = Rainbow::Color::Named::NAMES
|
31
|
-
if code = validcolors[meth]
|
29
|
+
if code = valid_colors[meth]
|
32
30
|
add_color_method meth.to_s, code + 30
|
33
31
|
send meth, *args, &blk
|
34
32
|
else
|
@@ -37,18 +35,25 @@ module Logue
|
|
37
35
|
end
|
38
36
|
|
39
37
|
def respond_to? meth
|
40
|
-
|
41
|
-
|
42
|
-
|
38
|
+
valid_colors.include?(meth) || super
|
39
|
+
end
|
40
|
+
|
41
|
+
def methods all = true
|
42
|
+
super + valid_colors.keys
|
43
43
|
end
|
44
44
|
|
45
45
|
def add_color_method color, code
|
46
|
-
|
47
|
-
a << 'def ' + color.to_s + '(msg = "", lvl = Logue::Level::DEBUG,
|
48
|
-
a << ' log("\e[' + code.to_s + 'm#{msg}\e[0m", lvl,
|
46
|
+
meth = Array.new.tap do |a|
|
47
|
+
a << 'def ' + color.to_s + '(msg = "", lvl = Logue::Level::DEBUG, classname: nil, &blk)'
|
48
|
+
a << ' log("\e[' + code.to_s + 'm#{msg}\e[0m", level: lvl, classname: classname, &blk)'
|
49
49
|
a << 'end'
|
50
50
|
end
|
51
|
-
instance_eval
|
51
|
+
instance_eval meth.join "\n"
|
52
|
+
end
|
53
|
+
|
54
|
+
def valid_colors
|
55
|
+
# Rainbow::X11ColorNames::NAMES
|
56
|
+
Rainbow::Color::Named::NAMES
|
52
57
|
end
|
53
58
|
end
|
54
59
|
end
|
data/lib/logue/legacy_logger.rb
CHANGED
data/lib/logue/level.rb
CHANGED
data/lib/logue/line.rb
CHANGED
@@ -7,15 +7,32 @@ module Logue
|
|
7
7
|
class Line
|
8
8
|
attr_reader :location
|
9
9
|
attr_reader :msg
|
10
|
+
attr_reader :obj
|
11
|
+
attr_reader :block
|
10
12
|
|
11
|
-
def initialize location, msg
|
13
|
+
def initialize location, msg, obj = nil, &blk
|
12
14
|
@location = location
|
13
15
|
@msg = msg
|
16
|
+
@obj = obj
|
17
|
+
@block = blk
|
18
|
+
end
|
19
|
+
|
20
|
+
def location_string locformat
|
21
|
+
@location.format locformat
|
22
|
+
end
|
23
|
+
|
24
|
+
def message_string
|
25
|
+
if @block
|
26
|
+
@block.call.to_s
|
27
|
+
elsif @obj
|
28
|
+
"#{@msg}: #{@obj}"
|
29
|
+
else
|
30
|
+
"#{@msg}"
|
31
|
+
end
|
14
32
|
end
|
15
33
|
|
16
34
|
def format locformat
|
17
|
-
|
18
|
-
logmsg + " " + @msg
|
35
|
+
location_string(locformat) + " " + message_string
|
19
36
|
end
|
20
37
|
end
|
21
38
|
end
|
data/lib/logue/location.rb
CHANGED
@@ -6,19 +6,19 @@ require 'logue/location_format'
|
|
6
6
|
module Logue
|
7
7
|
class Location
|
8
8
|
attr_reader :path
|
9
|
-
attr_reader :
|
9
|
+
attr_reader :line
|
10
10
|
attr_reader :cls
|
11
11
|
attr_reader :method
|
12
12
|
|
13
|
-
def initialize path,
|
13
|
+
def initialize path, line, cls, method
|
14
14
|
@path = path
|
15
|
-
@
|
15
|
+
@line = line
|
16
16
|
@cls = cls
|
17
17
|
@method = method
|
18
18
|
end
|
19
19
|
|
20
20
|
def format locformat
|
21
|
-
locformat.format @path, @
|
21
|
+
locformat.format @path, @line, @cls, @method
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -14,31 +14,18 @@ module Logue
|
|
14
14
|
attr_accessor :file
|
15
15
|
attr_accessor :line
|
16
16
|
attr_accessor :method
|
17
|
-
attr_accessor :trim
|
18
17
|
|
19
|
-
def initialize
|
18
|
+
def initialize file: Defaults::FILENAME, line: Defaults::LINE, method: Defaults::METHOD
|
20
19
|
@file = file
|
21
20
|
@line = line
|
22
21
|
@method = method
|
23
|
-
@trim = trim
|
24
|
-
end
|
25
|
-
|
26
|
-
def copy args
|
27
|
-
values = { file: @file, line: @line, method: @method, trim: @trim }
|
28
|
-
self.class.new values.merge(args)
|
29
22
|
end
|
30
23
|
|
31
|
-
def format path, line, cls,
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
if trim
|
37
|
-
path = PathUtil.trim_right path.to_s, @file
|
38
|
-
func = PathUtil.trim_left func, @method
|
39
|
-
end
|
40
|
-
|
41
|
-
sprintf format_string, path, line, func
|
24
|
+
def format path, line, cls, methname
|
25
|
+
name = cls ? cls.to_s + "#" + methname : methname
|
26
|
+
path = PathUtil.trim_right path.to_s, @file
|
27
|
+
name = PathUtil.trim_left name, @method
|
28
|
+
sprintf format_string, path, line, name
|
42
29
|
end
|
43
30
|
|
44
31
|
def format_string
|
data/lib/logue/log.rb
CHANGED
@@ -10,16 +10,12 @@
|
|
10
10
|
#
|
11
11
|
|
12
12
|
require 'logue/logger'
|
13
|
-
require 'logue/level'
|
14
|
-
require 'logue/colors'
|
15
13
|
|
16
14
|
#
|
17
15
|
# == Log
|
18
16
|
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
# class and method from where it called. If not in a class, it displays only the
|
22
|
-
# method.
|
17
|
+
# Log is the logger for anywhere within a program, writing to a single logger.
|
18
|
+
# See Loggable and Logger for more precise behavior.
|
23
19
|
#
|
24
20
|
# Remember: all kids love log.
|
25
21
|
#
|
@@ -52,26 +48,21 @@ require 'logue/colors'
|
|
52
48
|
|
53
49
|
module Logue
|
54
50
|
class Log
|
55
|
-
$LOGGING_LEVEL = nil
|
56
|
-
|
57
|
-
include Level
|
58
|
-
|
59
51
|
# by default, class methods delegate to a single app-wide log.
|
60
52
|
|
61
|
-
|
53
|
+
@logger = Logger.new
|
62
54
|
|
63
|
-
# Returns the logger of the log.
|
64
|
-
# method ... not so good. But temporary.
|
55
|
+
# Returns the app-wide logger of the log.
|
65
56
|
def self.logger
|
66
|
-
|
57
|
+
@logger
|
67
58
|
end
|
68
59
|
|
69
60
|
def self.accessors methname
|
70
61
|
[ methname.to_sym, (methname.to_s + "=").to_sym ]
|
71
62
|
end
|
72
|
-
|
73
|
-
def self.
|
74
|
-
|
63
|
+
|
64
|
+
def self.logger_methods
|
65
|
+
@logger_delegated ||= Array.new.tap do |ary|
|
75
66
|
acc_methods = [
|
76
67
|
:colorize_line,
|
77
68
|
:format,
|
@@ -81,7 +72,7 @@ module Logue
|
|
81
72
|
:quiet,
|
82
73
|
:verbose,
|
83
74
|
]
|
84
|
-
ary.concat acc_methods.
|
75
|
+
ary.concat acc_methods.inject(Array.new) { |a, m| a.concat accessors(m) }
|
85
76
|
read_methods = [
|
86
77
|
:ignore_class,
|
87
78
|
:ignore_file,
|
@@ -94,84 +85,54 @@ module Logue
|
|
94
85
|
:set_widths,
|
95
86
|
]
|
96
87
|
ary.concat read_methods
|
88
|
+
logging_methods = [
|
89
|
+
:debug,
|
90
|
+
:error,
|
91
|
+
:fatal,
|
92
|
+
:info,
|
93
|
+
:log,
|
94
|
+
:stack,
|
95
|
+
:warn,
|
96
|
+
:write,
|
97
|
+
]
|
98
|
+
ary.concat logging_methods
|
97
99
|
end
|
98
|
-
@@logger_delegated.include? meth
|
99
|
-
end
|
100
|
-
|
101
|
-
def self.method_missing meth, *args, &blk
|
102
|
-
if logger_delegated? meth
|
103
|
-
logger.send meth, *args, &blk
|
104
|
-
elsif Colors::valid_colors[meth]
|
105
|
-
# only handling foregrounds, not backgrounds
|
106
|
-
logger.send meth, *args, &blk
|
107
|
-
else
|
108
|
-
super
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
def self.respond_to? meth
|
113
|
-
logger_delegated?(meth) || Colors::valid_colors.include?(meth) || super
|
114
|
-
end
|
115
|
-
|
116
|
-
def self.add_color_method color, code
|
117
|
-
instmeth = Array.new
|
118
|
-
instmeth << "def #{color} msg = \"\", lvl = Log::DEBUG, cname = nil, &blk"
|
119
|
-
instmeth << " logger.#{color} (\"\\e[#{code}m\#{msg\}\\e[0m\", lvl, cname, &blk)"
|
120
|
-
instmeth << "end"
|
121
|
-
|
122
|
-
# an instance, but on the class object, not the log instance:
|
123
|
-
self.instance_eval instmeth.join("\n")
|
124
|
-
end
|
125
|
-
|
126
|
-
# Creates a printf format for the given widths, for aligning output.
|
127
|
-
def self.set_widths file_width, line_width, func_width
|
128
|
-
logger.set_widths file_width, line_width, func_width
|
129
100
|
end
|
130
101
|
|
131
|
-
def self.
|
132
|
-
|
102
|
+
def self.logger_delegated? meth
|
103
|
+
self.logger_methods.include? meth
|
133
104
|
end
|
134
105
|
|
135
|
-
def self.
|
136
|
-
|
106
|
+
def self.methods all = true
|
107
|
+
super + self.logger_methods + colors
|
137
108
|
end
|
138
109
|
|
139
|
-
def self.
|
140
|
-
|
110
|
+
def self.has_color? color
|
111
|
+
colors.include? color
|
141
112
|
end
|
142
113
|
|
143
|
-
def self.
|
144
|
-
logger.
|
114
|
+
def self.colors
|
115
|
+
logger.valid_colors.keys
|
145
116
|
end
|
146
117
|
|
147
|
-
def self.
|
148
|
-
|
118
|
+
def self.delegated? meth
|
119
|
+
logger_delegated?(meth) || has_color?(meth)
|
149
120
|
end
|
150
|
-
|
151
|
-
def self.
|
152
|
-
if
|
153
|
-
logger.
|
121
|
+
|
122
|
+
def self.method_missing meth, *args, &blk
|
123
|
+
if delegated? meth
|
124
|
+
logger.send meth, *args, &blk
|
154
125
|
else
|
155
|
-
|
126
|
+
super
|
156
127
|
end
|
157
128
|
end
|
158
129
|
|
159
|
-
def self.
|
160
|
-
|
161
|
-
logger.log msg, ERROR, cname, &blk
|
162
|
-
else
|
163
|
-
$stderr.puts "ERROR: " + msg
|
164
|
-
end
|
130
|
+
def self.respond_to? meth
|
131
|
+
methods.include? meth
|
165
132
|
end
|
166
133
|
|
167
|
-
def self.
|
168
|
-
|
169
|
-
stack msg, Log::WARN, cname, &blk
|
170
|
-
elsif quiet
|
171
|
-
# nothing
|
172
|
-
else
|
173
|
-
$stderr.puts msg
|
174
|
-
end
|
134
|
+
def self.respond_to_missing? *args
|
135
|
+
methods.include? args.first
|
175
136
|
end
|
176
137
|
end
|
177
138
|
end
|
data/lib/logue/loggable.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/ruby -w
|
2
2
|
# -*- ruby -*-
|
3
3
|
#
|
4
|
-
# =
|
4
|
+
# = loggable.rb
|
5
5
|
#
|
6
6
|
# Logging Module
|
7
7
|
#
|
@@ -9,8 +9,8 @@
|
|
9
9
|
# Documentation:: Author
|
10
10
|
#
|
11
11
|
|
12
|
+
require 'logue/logger'
|
12
13
|
require 'logue/log'
|
13
|
-
require 'logue/colors'
|
14
14
|
|
15
15
|
#
|
16
16
|
# == Loggable
|
@@ -40,63 +40,60 @@ require 'logue/colors'
|
|
40
40
|
|
41
41
|
module Logue
|
42
42
|
module Loggable
|
43
|
-
|
44
|
-
|
45
|
-
delegate_log_class.log msg, lvl, self.class.to_s, &blk
|
43
|
+
def logger
|
44
|
+
@@logger ||= Logger.new
|
46
45
|
end
|
47
46
|
|
48
|
-
def
|
49
|
-
|
47
|
+
def logger= logger
|
48
|
+
@@logger = logger
|
50
49
|
end
|
51
50
|
|
52
|
-
def
|
53
|
-
|
51
|
+
def respond_to_missing? *args
|
52
|
+
true
|
54
53
|
end
|
55
54
|
|
56
|
-
def
|
57
|
-
|
55
|
+
def methods all = true
|
56
|
+
methods_with_level + methods_without_level + super
|
58
57
|
end
|
59
58
|
|
60
|
-
def
|
61
|
-
|
59
|
+
def methods_with_level
|
60
|
+
[ :log, :stack ]
|
62
61
|
end
|
63
62
|
|
64
|
-
def
|
65
|
-
|
63
|
+
def methods_without_level
|
64
|
+
[ :debug, :info, :error, :fatal, :write ] + logger.valid_colors.keys
|
66
65
|
end
|
67
66
|
|
68
|
-
def
|
69
|
-
|
67
|
+
def warn msg = "", obj = nil, &blk
|
68
|
+
logger.warn msg, obj, classname: self.class.to_s, &blk
|
70
69
|
end
|
71
|
-
|
72
|
-
def
|
73
|
-
delegate_log_class.write msg, self.class.to_s, &blk
|
74
|
-
end
|
75
|
-
|
76
|
-
def method_missing meth, *args, &blk
|
70
|
+
|
71
|
+
def method_missing methname, *args, &blk
|
77
72
|
# only handling foregrounds, not backgrounds
|
78
|
-
if
|
79
|
-
|
80
|
-
send
|
73
|
+
if methods_with_level.include? methname
|
74
|
+
add_delegator methname, true
|
75
|
+
send methname, *args, &blk
|
76
|
+
elsif methods_without_level.include? methname
|
77
|
+
add_delegator methname, false
|
78
|
+
send methname, *args, &blk
|
81
79
|
else
|
82
80
|
super
|
83
81
|
end
|
84
82
|
end
|
85
83
|
|
86
|
-
def
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
Log
|
84
|
+
def add_delegator methname, with_level
|
85
|
+
lines = Array.new.tap do |a|
|
86
|
+
if with_level
|
87
|
+
a << "def #{methname} msg = '', obj = nil, level = Level::DEBUG, &blk"
|
88
|
+
a << " logger.send :#{methname}, msg, obj, level: level, classname: self.class.to_s, &blk"
|
89
|
+
else
|
90
|
+
a << "def #{methname} msg = '', obj = nil, &blk"
|
91
|
+
a << " logger.send :#{methname}, msg, obj, classname: self.class.to_s, &blk"
|
92
|
+
end
|
93
|
+
a << "end"
|
94
|
+
end
|
95
|
+
|
96
|
+
instance_eval lines.join("\n")
|
100
97
|
end
|
101
98
|
end
|
102
99
|
end
|
data/lib/logue/logger.rb
CHANGED
@@ -14,7 +14,9 @@ require 'logue/colorlog'
|
|
14
14
|
require 'logue/writer'
|
15
15
|
require 'logue/filter'
|
16
16
|
require 'logue/legacy_logger'
|
17
|
+
require 'logue/location'
|
17
18
|
require 'logue/stack'
|
19
|
+
require 'logue/line'
|
18
20
|
|
19
21
|
#
|
20
22
|
# == Logger
|
@@ -36,26 +38,24 @@ module Logue
|
|
36
38
|
attr_accessor :format
|
37
39
|
attr_accessor :filter
|
38
40
|
attr_accessor :writer
|
39
|
-
|
40
|
-
include Level
|
41
41
|
|
42
|
-
def initialize format: LocationFormat.new, level: WARN, filter: Filter.new, writer: Writer.new
|
42
|
+
def initialize format: LocationFormat.new, level: Level::WARN, filter: Filter.new, writer: Writer.new
|
43
43
|
reset format: format, level: level, filter: filter, writer: writer
|
44
44
|
end
|
45
45
|
|
46
46
|
def verbose= v
|
47
47
|
@level = case v
|
48
48
|
when TrueClass
|
49
|
-
DEBUG
|
49
|
+
Level::DEBUG
|
50
50
|
when FalseClass
|
51
|
-
FATAL
|
51
|
+
Level::FATAL
|
52
52
|
when Integer
|
53
53
|
v
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
57
|
def verbose
|
58
|
-
@level <= DEBUG
|
58
|
+
@level <= Level::DEBUG
|
59
59
|
end
|
60
60
|
|
61
61
|
def reset format: LocationFormat.new, level: FATAL, filter: Filter.new, writer: Writer.new
|
@@ -66,11 +66,11 @@ module Logue
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def quiet
|
69
|
-
@level >= WARN
|
69
|
+
@level >= Level::WARN
|
70
70
|
end
|
71
71
|
|
72
72
|
def quiet= b
|
73
|
-
@level = b ? WARN : DEBUG
|
73
|
+
@level = b ? Level::WARN : Level::DEBUG
|
74
74
|
end
|
75
75
|
|
76
76
|
# Assigns output to a file with the given name. Returns the file; the client is responsible for
|
@@ -86,56 +86,59 @@ module Logue
|
|
86
86
|
@format = LocationFormat.new file: file, line: line, method: method
|
87
87
|
end
|
88
88
|
|
89
|
-
def debug msg = "",
|
90
|
-
log msg, DEBUG,
|
89
|
+
def debug msg = "", obj = nil, classname: nil, &blk
|
90
|
+
log msg, obj, level: Level::DEBUG, classname: classname, &blk
|
91
91
|
end
|
92
92
|
|
93
|
-
def info msg = "",
|
94
|
-
log msg, INFO,
|
93
|
+
def info msg = "", obj = nil, classname: nil, &blk
|
94
|
+
log msg, obj, level: Level::INFO, classname: classname, &blk
|
95
95
|
end
|
96
96
|
|
97
|
-
def warn msg = "",
|
98
|
-
log msg, WARN,
|
97
|
+
def warn msg = "", obj = nil, classname: nil, &blk
|
98
|
+
log msg, obj, level: Level::WARN, classname: classname, &blk
|
99
99
|
end
|
100
100
|
|
101
|
-
def error msg = "",
|
102
|
-
log msg, ERROR,
|
101
|
+
def error msg = "", obj = nil, classname: nil, &blk
|
102
|
+
log msg, obj, level: Level::ERROR, classname: classname, &blk
|
103
103
|
end
|
104
104
|
|
105
|
-
def fatal msg = "",
|
106
|
-
log msg, FATAL,
|
105
|
+
def fatal msg = "", obj = nil, classname: nil, &blk
|
106
|
+
log msg, obj, level: Level::FATAL, classname: classname, &blk
|
107
107
|
end
|
108
108
|
|
109
109
|
# Logs the given message.
|
110
|
-
def log msg = "",
|
111
|
-
log_frames
|
110
|
+
def log msg = "", obj = nil, level: Level::DEBUG, classname: nil, &blk
|
111
|
+
log_frames msg, obj, classname: classname, level: level, nframes: 0, &blk
|
112
112
|
end
|
113
113
|
|
114
114
|
# Shows the current stack.
|
115
|
-
def stack msg = "",
|
116
|
-
log_frames
|
115
|
+
def stack msg = "", obj = nil, level: Level::DEBUG, classname: nil, &blk
|
116
|
+
log_frames msg, obj, classname: classname, level: level, nframes: -1, &blk
|
117
117
|
end
|
118
118
|
|
119
|
-
def log_frames
|
120
|
-
if
|
119
|
+
def log_frames msg, obj = nil, classname: nil, level: nil, nframes: -1, &blk
|
120
|
+
if level >= @level
|
121
121
|
stack = Stack.new
|
122
|
-
stack.filtered[0 ..
|
123
|
-
log_frame frame,
|
124
|
-
|
125
|
-
msg
|
122
|
+
stack.filtered[0 .. nframes].each do |frame|
|
123
|
+
log_frame frame, msg, obj, classname: classname, level: level, &blk
|
124
|
+
classname = nil
|
125
|
+
msg = ""
|
126
|
+
obj = nil
|
126
127
|
end
|
127
128
|
end
|
128
129
|
end
|
129
130
|
|
130
|
-
def log_frame frame,
|
131
|
-
if @filter.log? frame.path,
|
132
|
-
|
131
|
+
def log_frame frame, msg, obj, classname: nil, level: nil, &blk
|
132
|
+
if @filter.log? frame.path, classname, frame.method
|
133
|
+
print_frame frame, msg, obj, classname: classname, level: level, &blk
|
133
134
|
end
|
134
135
|
end
|
135
136
|
|
136
|
-
def
|
137
|
-
|
138
|
-
|
137
|
+
def print_frame frame, msg, obj, classname: nil, level: nil, &blk
|
138
|
+
loc = Location.new frame.path, frame.line, classname, frame.method
|
139
|
+
line = Line.new loc, msg, obj, &blk
|
140
|
+
lstr = line.format @format
|
141
|
+
@writer.print lstr, level
|
139
142
|
end
|
140
143
|
end
|
141
144
|
end
|
data/lib/logue/stack.rb
CHANGED
data/lib/logue/version.rb
CHANGED
data/lib/logue/writer.rb
CHANGED
@@ -13,19 +13,9 @@ module Logue
|
|
13
13
|
@colorize_line = colorize_line
|
14
14
|
end
|
15
15
|
|
16
|
-
def print
|
17
|
-
|
18
|
-
|
19
|
-
if x.kind_of? String
|
20
|
-
msg = x
|
21
|
-
else
|
22
|
-
return
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
msg = msg.to_s.chomp
|
27
|
-
line = line location, msg, lvl
|
28
|
-
@output.puts line
|
16
|
+
def print lstr, lvl
|
17
|
+
str = lvlcol = @colors[lvl] ? lstr.color(lvlcol) : lstr
|
18
|
+
@output.puts str
|
29
19
|
end
|
30
20
|
|
31
21
|
def line location, msg, lvl
|
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.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Pace
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -98,7 +98,6 @@ files:
|
|
98
98
|
- bin/setup
|
99
99
|
- lib/logue.rb
|
100
100
|
- lib/logue/colorlog.rb
|
101
|
-
- lib/logue/colors.rb
|
102
101
|
- lib/logue/filter.rb
|
103
102
|
- lib/logue/frame.rb
|
104
103
|
- lib/logue/legacy_logger.rb
|
@@ -110,7 +109,6 @@ files:
|
|
110
109
|
- lib/logue/loggable.rb
|
111
110
|
- lib/logue/logger.rb
|
112
111
|
- lib/logue/pathutil.rb
|
113
|
-
- lib/logue/severity.rb
|
114
112
|
- lib/logue/stack.rb
|
115
113
|
- lib/logue/version.rb
|
116
114
|
- lib/logue/writer.rb
|
@@ -136,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
134
|
version: '0'
|
137
135
|
requirements: []
|
138
136
|
rubyforge_project:
|
139
|
-
rubygems_version: 2.
|
137
|
+
rubygems_version: 2.5.2.1
|
140
138
|
signing_key:
|
141
139
|
specification_version: 4
|
142
140
|
summary: A minimalist logging module.
|
data/lib/logue/colors.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# -*- ruby -*-
|
3
|
-
#
|
4
|
-
# = colors.rb
|
5
|
-
#
|
6
|
-
# Logging Module
|
7
|
-
#
|
8
|
-
# Author:: Jeff Pace <jeugenepace@gmail.com>
|
9
|
-
# Documentation:: Author
|
10
|
-
#
|
11
|
-
|
12
|
-
require 'rainbow/x11_color_names'
|
13
|
-
require 'rainbow/color'
|
14
|
-
|
15
|
-
class Colors
|
16
|
-
def self.valid_colors
|
17
|
-
Rainbow::Color::Named::NAMES
|
18
|
-
end
|
19
|
-
end
|
data/lib/logue/severity.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# -*- ruby -*-
|
3
|
-
#
|
4
|
-
# = level.rb
|
5
|
-
#
|
6
|
-
# Logging Module
|
7
|
-
#
|
8
|
-
# Author:: Jeff Pace <jeugenepace@gmail.com>
|
9
|
-
# Documentation:: Author
|
10
|
-
#
|
11
|
-
|
12
|
-
require 'logue/level'
|
13
|
-
|
14
|
-
module Logue
|
15
|
-
class Log
|
16
|
-
# legacy module that is replaced by Logue::Level
|
17
|
-
module Severity
|
18
|
-
include Logue::Level
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|