RTALogger 2.1.1 → 2.3.1
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +11 -6
- data/lib/RTALogger/version.rb +1 -1
- data/lib/log_factory_filter.rb +1 -1
- data/lib/log_factory_log_formatter.rb +1 -1
- data/lib/log_filter_base.rb +19 -0
- data/lib/log_filter_context.rb +3 -1
- data/lib/log_filter_message.rb +3 -1
- data/lib/log_filter_topic.rb +3 -1
- data/lib/log_formatter_base.rb +46 -1
- data/lib/log_formatter_json.rb +16 -3
- data/lib/log_formatter_text.rb +1 -4
- data/lib/log_manager.rb +4 -2
- data/lib/log_propagator.rb +1 -1
- data/lib/log_repository.rb +3 -3
- data/lib/log_repository_file.rb +2 -0
- data/lib/log_repository_fluentd.rb +2 -0
- data/lib/rta_logger_config.json +8 -5
- data/lib/sample.rb +9 -0
- data/lib/string.rb +33 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72e3d3eb0005d4dcf6ad556e952a15aa354bc5c33c257eb95d595a3d48a69c57
|
4
|
+
data.tar.gz: 6317c92c72a523235002ae18bcc51208b0f6f6b8fa77e620ae098cea6b1316d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1a6bf4e33b08c428fc20f38c568bad661c3e79eab55de3238cf1355b6dd070b1f39c441275ee48b7548e037b76bef3b8762f13113e1fdae66759124dedf9568
|
7
|
+
data.tar.gz: dd4c4497c89d9a063aaf42be760254e8aff3edf66fce6a78c24976ffc91c813a82efa5c80fca9c5c86a183f61b34a93b70ac52524834fb077cceff7bf3c7bd66
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -94,7 +94,7 @@ To use log manager APIs, first step is to have a quick review on Log Data Struct
|
|
94
94
|
"app_name": "TestApp",
|
95
95
|
"severity_level": "trace",
|
96
96
|
"buffer_size": 100,
|
97
|
-
"flush_wait_seconds":
|
97
|
+
"flush_wait_seconds": 5,
|
98
98
|
"repositories":
|
99
99
|
[
|
100
100
|
{
|
@@ -104,7 +104,8 @@ To use log manager APIs, first step is to have a quick review on Log Data Struct
|
|
104
104
|
"formatter":
|
105
105
|
{
|
106
106
|
"type": "text",
|
107
|
-
"delimiter": "|"
|
107
|
+
"delimiter": "|",
|
108
|
+
"colorize": true
|
108
109
|
},
|
109
110
|
"filters":
|
110
111
|
[
|
@@ -206,7 +207,7 @@ the result will be:
|
|
206
207
|
"app_name": "TestApp",
|
207
208
|
"severity_level": "trace",
|
208
209
|
"buffer_size": 100,
|
209
|
-
"flush_wait_seconds":
|
210
|
+
"flush_wait_seconds": 5,
|
210
211
|
"repositories":
|
211
212
|
[
|
212
213
|
{
|
@@ -216,7 +217,8 @@ the result will be:
|
|
216
217
|
"formatter":
|
217
218
|
{
|
218
219
|
"type": "text",
|
219
|
-
"delimiter": "|"
|
220
|
+
"delimiter": "|",
|
221
|
+
"colorize": true
|
220
222
|
},
|
221
223
|
"filters":
|
222
224
|
[
|
@@ -291,7 +293,7 @@ the result will be:
|
|
291
293
|
- buffer_size: Minimune possible value for this attribute is 100 and defines memory buffer size (number of buffered log objects) to
|
292
294
|
decread api consumers wait time. when the buffer is full the flush operation will
|
293
295
|
save buffered logs to log repositoies.
|
294
|
-
- flush_wait_seconds: Minimum possible value for this attribure is
|
296
|
+
- flush_wait_seconds: Minimum possible value for this attribure is 5 seconds and defines time in soconds which log managers wait to flush buffered log records
|
295
297
|
to log repository.
|
296
298
|
- repositories: Array of log repositories. It is possible to define multiple log repositories to
|
297
299
|
store log data. there are variaty of log repositories and it is possible to
|
@@ -305,6 +307,8 @@ the result will be:
|
|
305
307
|
- "foramtter" is the text, json or any custome defined types as LogRecord formatter
|
306
308
|
- "type": ["text"/"json"] type of formatter
|
307
309
|
- "delimiter": [any text delimiter you need.(as an instance pipe line "|")]
|
310
|
+
- "colorize": [true/false] default value of this attribute is false.
|
311
|
+
if you need to colorize your out put format on standard output set this attribute to true.
|
308
312
|
if formatter not defined then the json formatter will be used
|
309
313
|
2- file: Store log data in a file.
|
310
314
|
- "type": "console"
|
@@ -348,6 +352,7 @@ the result will be:
|
|
348
352
|
"enable": [true/false] this will enable or disable filtering opration of current filter.
|
349
353
|
"default_regex": "valid regual expression" to compare with corresponding attribute.
|
350
354
|
* It's possible to implement customize filter classes and integerate with RTALogger filter factory.
|
355
|
+
* In RTALogger version 2.2.0 colorize out put format is availabel.
|
351
356
|
- topics: This is an optional item. When you need to customize a specific topic severity level or
|
352
357
|
enable value, you can define the settings here.
|
353
358
|
- title: The topic title to customize. (mandatoy).
|
@@ -387,7 +392,7 @@ the result will be:
|
|
387
392
|
# log_manager.enable
|
388
393
|
# log_manager.default_severity_level
|
389
394
|
# log_manager.buffer_size (minimum is 100)
|
390
|
-
# log_manager.flush_wait_time (minimum
|
395
|
+
# log_manager.flush_wait_time (minimum 5 second)
|
391
396
|
# repository.enable
|
392
397
|
# topic.enable
|
393
398
|
# topic.severity_level
|
data/lib/RTALogger/version.rb
CHANGED
data/lib/log_factory_filter.rb
CHANGED
@@ -9,7 +9,7 @@ module RTALogger
|
|
9
9
|
begin
|
10
10
|
load lib_file
|
11
11
|
rescue
|
12
|
-
raise "unable to load
|
12
|
+
raise "unable to load filter class file: #{lib_file}"
|
13
13
|
end
|
14
14
|
|
15
15
|
filter_class_name = 'RTALogger::' + ('log_filter_' + type.to_s).split('_').map(&:capitalize).join
|
@@ -21,7 +21,7 @@ module RTALogger
|
|
21
21
|
return nil unless formatter_class
|
22
22
|
result = formatter_class.new
|
23
23
|
|
24
|
-
return result if config_json.empty?
|
24
|
+
return result if config_json.nil? || config_json.empty?
|
25
25
|
result.load_config(config_json) if result.present?
|
26
26
|
return result
|
27
27
|
end
|
data/lib/log_filter_base.rb
CHANGED
@@ -3,11 +3,14 @@ module RTALogger
|
|
3
3
|
def initialize
|
4
4
|
@title = self.class.to_s.split('::').last.underscore
|
5
5
|
@enable = true
|
6
|
+
@action = :accept
|
6
7
|
end
|
7
8
|
|
8
9
|
attr_accessor :title
|
9
10
|
attr_accessor :enable
|
10
11
|
attr_accessor :default_regex
|
12
|
+
# possible values: accept, ignore
|
13
|
+
attr_accessor :action
|
11
14
|
|
12
15
|
def match_conditions(log_record)
|
13
16
|
return true if !@enable
|
@@ -18,11 +21,13 @@ module RTALogger
|
|
18
21
|
@title = config_json['title'] if config_json['title'].present?
|
19
22
|
@enable = config_json['enable'].nil? ? true : config_json['enable'].present?
|
20
23
|
@default_regex = config_json['default_regex'] if config_json['default_regex'].present?
|
24
|
+
@action = valid_action(config_json['action']) if config_json['action'].present?
|
21
25
|
end
|
22
26
|
|
23
27
|
def apply_run_time_config(config_json)
|
24
28
|
@enable = config_json['enable'].nil? ? true : config_json['enable'].present?
|
25
29
|
@default_regex = config_json['default_regex'] if config_json['default_regex'].present?
|
30
|
+
@action = valid_action(config_json['action']) if config_json['action'].present?
|
26
31
|
end
|
27
32
|
|
28
33
|
def to_builder
|
@@ -31,9 +36,23 @@ module RTALogger
|
|
31
36
|
json.title @title
|
32
37
|
json.enable @enable
|
33
38
|
json.default_regex @default_regex
|
39
|
+
json.action @action.to_s
|
34
40
|
end
|
35
41
|
|
36
42
|
jb
|
37
43
|
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def valid_action(action_value)
|
48
|
+
case action_value.to_s.downcase
|
49
|
+
when 'accept'
|
50
|
+
:accept
|
51
|
+
when 'ignore'
|
52
|
+
:ignore
|
53
|
+
else
|
54
|
+
:accept
|
55
|
+
end
|
56
|
+
end
|
38
57
|
end
|
39
58
|
end
|
data/lib/log_filter_context.rb
CHANGED
@@ -7,7 +7,9 @@ module RTALogger
|
|
7
7
|
result = super
|
8
8
|
return result unless result
|
9
9
|
|
10
|
-
|
10
|
+
result = default_regex.present? ? (Regexp.new(@default_regex).match(log_record.context_id.to_s)) : result
|
11
|
+
result = !result if @action == :ignore
|
12
|
+
return result
|
11
13
|
end
|
12
14
|
end
|
13
15
|
end
|
data/lib/log_filter_message.rb
CHANGED
@@ -7,7 +7,9 @@ module RTALogger
|
|
7
7
|
result = super
|
8
8
|
return result unless result
|
9
9
|
|
10
|
-
|
10
|
+
result = default_regex.present? ? (Regexp.new(@default_regex).match(log_record.full_message)) : result
|
11
|
+
result = !result if @action == :ignore
|
12
|
+
return result
|
11
13
|
end
|
12
14
|
end
|
13
15
|
end
|
data/lib/log_filter_topic.rb
CHANGED
@@ -7,7 +7,9 @@ module RTALogger
|
|
7
7
|
result = super
|
8
8
|
return result unless result
|
9
9
|
|
10
|
-
|
10
|
+
result = default_regex.present? ? (Regexp.new(@default_regex).match(log_record.topic_title)) : result
|
11
|
+
result = !result if @action == :ignore
|
12
|
+
return result
|
11
13
|
end
|
12
14
|
end
|
13
15
|
end
|
data/lib/log_formatter_base.rb
CHANGED
@@ -1,16 +1,24 @@
|
|
1
1
|
require 'jbuilder'
|
2
2
|
require_relative 'string'
|
3
|
+
require_relative 'severity_level'
|
3
4
|
|
4
5
|
module RTALogger
|
5
6
|
class LogFormatterBase
|
7
|
+
include SeverityLevel
|
8
|
+
|
6
9
|
def initialize
|
7
10
|
@delimiter = '|'
|
11
|
+
@colorize = false
|
8
12
|
end
|
9
13
|
|
10
14
|
attr_accessor :delimiter
|
15
|
+
attr_accessor :colorize
|
11
16
|
|
12
17
|
def load_config(config_json)
|
18
|
+
return unless config_json.present?
|
19
|
+
|
13
20
|
@delimiter = config_json['delimiter'].nil? ? true : config_json['delimiter']
|
21
|
+
@colorize = config_json['colorize'].nil? ? false : config_json['colorize']
|
14
22
|
end
|
15
23
|
|
16
24
|
def format(log_record)
|
@@ -20,7 +28,8 @@ module RTALogger
|
|
20
28
|
def to_builder
|
21
29
|
jb = Jbuilder.new do |json|
|
22
30
|
json.type self.class.to_s.split('::').last.underscore.sub('log_formatter_', '')
|
23
|
-
json.delimiter delimiter
|
31
|
+
json.delimiter @delimiter
|
32
|
+
json.colorize @colorize
|
24
33
|
end
|
25
34
|
|
26
35
|
jb
|
@@ -29,5 +38,41 @@ module RTALogger
|
|
29
38
|
def reveal_config
|
30
39
|
to_builder.target!
|
31
40
|
end
|
41
|
+
|
42
|
+
def apply_run_time_config(config_json)
|
43
|
+
return unless config_json.present?
|
44
|
+
|
45
|
+
@delimiter = config_json['delimiter'] unless config_json['delimiter'].nil?
|
46
|
+
@colorize = config_json['colorize'] unless config_json['colorize'].nil?
|
47
|
+
end
|
48
|
+
|
49
|
+
protected
|
50
|
+
|
51
|
+
def severity_text(severity)
|
52
|
+
text = parse_severity_level_to_s(severity)
|
53
|
+
text = severity_colorized_text(severity, text) if @colorize
|
54
|
+
return text
|
55
|
+
end
|
56
|
+
|
57
|
+
def severity_colorized_text(severity, text)
|
58
|
+
case severity
|
59
|
+
when 0
|
60
|
+
text.trace_color
|
61
|
+
when 1
|
62
|
+
text.debug_color
|
63
|
+
when 2
|
64
|
+
text
|
65
|
+
when 3
|
66
|
+
text.warning_color
|
67
|
+
when 4
|
68
|
+
text.error_color
|
69
|
+
when 5
|
70
|
+
text.fatal_color
|
71
|
+
when 6
|
72
|
+
text.unknown_color
|
73
|
+
else
|
74
|
+
text
|
75
|
+
end
|
76
|
+
end
|
32
77
|
end
|
33
78
|
end
|
data/lib/log_formatter_json.rb
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
require 'jbuilder'
|
2
2
|
require_relative 'log_formatter_base'
|
3
|
-
require_relative '
|
3
|
+
require_relative 'string'
|
4
4
|
|
5
5
|
module RTALogger
|
6
6
|
# json formatter which receive log_record and
|
7
7
|
# returns it's data as json string
|
8
8
|
class LogFormatterJson < LogFormatterBase
|
9
|
-
include SeverityLevel
|
10
9
|
|
11
10
|
def format(log_record)
|
12
11
|
return '' unless log_record
|
@@ -20,7 +19,21 @@ module RTALogger
|
|
20
19
|
json.message log_record.message.flatten.join(' ')
|
21
20
|
end
|
22
21
|
|
23
|
-
jb.target!
|
22
|
+
result = jb.target!
|
23
|
+
result = colorize_json(result) if @colorize
|
24
|
+
|
25
|
+
return result
|
26
|
+
end
|
27
|
+
|
28
|
+
protected
|
29
|
+
|
30
|
+
def colorize_json(json_text)
|
31
|
+
json_text.gsub(/"severity":"TRACE"/i, '"severity":"TRACE"'.trace_color)
|
32
|
+
.gsub(/"severity":"DEBUG"/i, '"severity":"DEBUG"'.debug_color)
|
33
|
+
.gsub(/"severity":"WARN"/i, '"severity":"WARN"'.warning_color)
|
34
|
+
.gsub(/"severity":"ERROR"/i, '"severity":"ERROR"'.error_color)
|
35
|
+
.gsub(/"severity":"FATAL"/i, '"severity":"FATAL"'.fatal_color)
|
36
|
+
.gsub(/"severity":"UNKNOWN"/i, '"severity":"UNKNOWN"'.unknown_color)
|
24
37
|
end
|
25
38
|
end
|
26
39
|
end
|
data/lib/log_formatter_text.rb
CHANGED
@@ -1,12 +1,9 @@
|
|
1
1
|
require_relative 'log_formatter_base'
|
2
|
-
require_relative 'severity_level'
|
3
2
|
|
4
3
|
module RTALogger
|
5
4
|
# text formatter which receive log_record and
|
6
5
|
# returns it's data as delimited text string
|
7
6
|
class LogFormatterText < LogFormatterBase
|
8
|
-
include SeverityLevel
|
9
|
-
|
10
7
|
def format(log_record)
|
11
8
|
return '' unless log_record
|
12
9
|
|
@@ -14,7 +11,7 @@ module RTALogger
|
|
14
11
|
result << @delimiter << log_record.app_name
|
15
12
|
result << @delimiter << log_record.topic_title
|
16
13
|
result << @delimiter << log_record.context_id.to_s
|
17
|
-
result << @delimiter <<
|
14
|
+
result << @delimiter << severity_text(log_record.severity)
|
18
15
|
result << @delimiter << log_record.message.join(' ').gsub(delimiter, '$<$')
|
19
16
|
|
20
17
|
result
|
data/lib/log_manager.rb
CHANGED
@@ -27,7 +27,7 @@ module RTALogger
|
|
27
27
|
@topic_semaphore = Mutex.new
|
28
28
|
@log_semaphore = Mutex.new
|
29
29
|
self.buffer_size = ENV.fetch('RTA_LOGGER_BUFFER_SIZE', 100)
|
30
|
-
self.flush_wait_time = ENV.fetch('RTA_LOGGER_FLUSH_WAIT_SECONDS',
|
30
|
+
self.flush_wait_time = ENV.fetch('RTA_LOGGER_FLUSH_WAIT_SECONDS', 5)
|
31
31
|
@topics = {}
|
32
32
|
@log_records = []
|
33
33
|
@propagator = LogFactory.new_log_propagator
|
@@ -64,13 +64,14 @@ module RTALogger
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def flush_wait_time=(time_in_seconds)
|
67
|
-
@flush_wait_time = time_in_seconds <
|
67
|
+
@flush_wait_time = time_in_seconds < 5 ? 5 : time_in_seconds
|
68
68
|
end
|
69
69
|
|
70
70
|
def config_use_json_file(file_name, title = '')
|
71
71
|
config_json = load_config_from_json_file(file_name, title)
|
72
72
|
@config_file_name = file_name if config_json
|
73
73
|
apply_config(config_json)
|
74
|
+
self
|
74
75
|
rescue StandardError => e
|
75
76
|
@propagator.drop_all_repositories
|
76
77
|
@propagator.add_log_repository(LogFactory.create_repository(:console))
|
@@ -79,6 +80,7 @@ module RTALogger
|
|
79
80
|
def config_use_json_string(config_string, title = '')
|
80
81
|
config_json = load_config_from_json_string(config_string, title)
|
81
82
|
apply_config(config_json)
|
83
|
+
self
|
82
84
|
rescue StandardError => e
|
83
85
|
@propagator.drop_all_repositories
|
84
86
|
@propagator.add_log_repository(LogFactory.create_repository(:console))
|
data/lib/log_propagator.rb
CHANGED
@@ -92,7 +92,7 @@ module RTALogger
|
|
92
92
|
if repository.present?
|
93
93
|
repository.apply_run_time_config(repository_config)
|
94
94
|
else
|
95
|
-
repository = ::RTALogger::LogFactory.create_repository(repository_config['type'],
|
95
|
+
repository = ::RTALogger::LogFactory.create_repository(repository_config['type'], repository_config)
|
96
96
|
add_log_repository(repository)
|
97
97
|
end
|
98
98
|
end
|
data/lib/log_repository.rb
CHANGED
@@ -47,9 +47,8 @@ module RTALogger
|
|
47
47
|
@enable = config_json['enable'].nil? ? true : config_json['enable']
|
48
48
|
@title = config_json['title'].nil? ? self.class.to_s.split('::').last.underscore : config_json['title']
|
49
49
|
formatter_config = config_json['formatter']
|
50
|
-
|
51
|
-
|
52
|
-
end
|
50
|
+
|
51
|
+
@formatter = LogFactory.create_formatter(formatter_config['type'], formatter_config) if formatter_config && formatter_config['type']
|
53
52
|
|
54
53
|
apply_config_filters(config_json)
|
55
54
|
end
|
@@ -87,6 +86,7 @@ module RTALogger
|
|
87
86
|
def apply_run_time_config(config_json)
|
88
87
|
return unless config_json
|
89
88
|
@enable = config_json['enable'] unless config_json['enable'].nil?
|
89
|
+
@formatter.apply_run_time_config(config_json['formatter'])
|
90
90
|
apply_run_time_config_filters(config_json)
|
91
91
|
end
|
92
92
|
|
data/lib/log_repository_file.rb
CHANGED
@@ -62,6 +62,8 @@ module RTALogger
|
|
62
62
|
@port = config_json['port'] unless config_json['port'].nil?
|
63
63
|
@tls_options = config_json['tls_options'] unless config_json['tls_options'].nil?
|
64
64
|
@semaphore.synchronize { @fluent_logger = nil }
|
65
|
+
|
66
|
+
@formatter.colorize = false
|
65
67
|
end
|
66
68
|
|
67
69
|
protected
|
data/lib/rta_logger_config.json
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
"app_name": "TestApp",
|
11
11
|
"severity_level": "trace",
|
12
12
|
"buffer_size": 100,
|
13
|
-
"flush_wait_seconds":
|
13
|
+
"flush_wait_seconds": 5,
|
14
14
|
"repositories":
|
15
15
|
[
|
16
16
|
{
|
@@ -20,18 +20,21 @@
|
|
20
20
|
"formatter":
|
21
21
|
{
|
22
22
|
"type": "text",
|
23
|
-
"delimiter": "|"
|
23
|
+
"delimiter": "|",
|
24
|
+
"colorize": true
|
24
25
|
},
|
25
26
|
"filters":
|
26
27
|
[
|
27
28
|
{
|
28
29
|
"type": "topic",
|
30
|
+
"action" : "ignore",
|
29
31
|
"title": "topic_filter_1",
|
30
|
-
"enable":
|
31
|
-
"default_regex" : "^test$"
|
32
|
+
"enable": false,
|
33
|
+
"default_regex" : "^test$",
|
32
34
|
},
|
33
35
|
{
|
34
36
|
"type": "message",
|
37
|
+
"action" : "accept",
|
35
38
|
"title": "message_filter_1",
|
36
39
|
"enable": false,
|
37
40
|
"default_regex" : "error"
|
@@ -52,9 +55,9 @@
|
|
52
55
|
}
|
53
56
|
},
|
54
57
|
{
|
55
|
-
"enable": false,
|
56
58
|
"title": "fluentd_repo_1",
|
57
59
|
"type": "fluentd",
|
60
|
+
"enable": false,
|
58
61
|
"host": "localhost",
|
59
62
|
"port": "8888",
|
60
63
|
"formatter":
|
data/lib/sample.rb
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
require_relative 'log_factory_manager'
|
2
2
|
require_relative 'log_factory_repository'
|
3
|
+
# require_relative 'string'
|
4
|
+
|
5
|
+
# puts 'trace'.gray
|
6
|
+
# puts 'debug'.green
|
7
|
+
# puts 'info'
|
8
|
+
# puts 'warning'.brown
|
9
|
+
# puts 'error'.red
|
10
|
+
# puts 'fatal'.bg_red
|
11
|
+
# puts 'unknown'.bg_cyan
|
3
12
|
|
4
13
|
controller_name = 'test_controller'
|
5
14
|
userID = 5
|
data/lib/string.rb
CHANGED
@@ -1,9 +1,40 @@
|
|
1
1
|
class String
|
2
2
|
def underscore
|
3
3
|
self.gsub(/::/, '/').
|
4
|
-
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
5
|
-
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
4
|
+
gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').
|
5
|
+
gsub(/([a-z\d])([A-Z])/, '\1_\2').
|
6
6
|
tr("-", "_").
|
7
7
|
downcase
|
8
8
|
end
|
9
|
+
|
10
|
+
def black; "\e[30m#{self}\e[0m" end
|
11
|
+
def red; "\e[31m#{self}\e[0m" end
|
12
|
+
def green; "\e[32m#{self}\e[0m" end
|
13
|
+
def brown; "\e[33m#{self}\e[0m" end
|
14
|
+
def blue; "\e[34m#{self}\e[0m" end
|
15
|
+
def magenta; "\e[35m#{self}\e[0m" end
|
16
|
+
def cyan; "\e[36m#{self}\e[0m" end
|
17
|
+
def gray; "\e[37m#{self}\e[0m" end
|
18
|
+
|
19
|
+
def bg_black; "\e[40m#{self}\e[0m" end
|
20
|
+
def bg_red; "\e[41m#{self}\e[0m" end
|
21
|
+
def bg_green; "\e[42m#{self}\e[0m" end
|
22
|
+
def bg_brown; "\e[43m#{self}\e[0m" end
|
23
|
+
def bg_blue; "\e[44m#{self}\e[0m" end
|
24
|
+
def bg_magenta; "\e[45m#{self}\e[0m" end
|
25
|
+
def bg_cyan; "\e[46m#{self}\e[0m" end
|
26
|
+
def bg_gray; "\e[47m#{self}\e[0m" end
|
27
|
+
|
28
|
+
def bold; "\e[1m#{self}\e[22m" end
|
29
|
+
def italic; "\e[3m#{self}\e[23m" end
|
30
|
+
def underline; "\e[4m#{self}\e[24m" end
|
31
|
+
def blink; "\e[5m#{self}\e[25m" end
|
32
|
+
def reverse_color; "\e[7m#{self}\e[27m" end
|
33
|
+
|
34
|
+
def trace_color; self.gray end
|
35
|
+
def debug_color; self.green end
|
36
|
+
def warning_color; self.brown end
|
37
|
+
def error_color; self.red end
|
38
|
+
def fatal_color; self.bg_red end
|
39
|
+
def unknown_color; self.bg_cyan end
|
9
40
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: RTALogger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Babak Bahreini, RTA Backend Team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluent-logger
|