legion-logging 0.2.0 → 0.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/.circleci/config.yml +142 -36
- data/.idea/.rakeTasks +7 -0
- data/.idea/legion-logging.iml +36 -0
- data/.idea/misc.xml +7 -0
- data/.idea/modules.xml +8 -0
- data/.idea/vagrant.xml +7 -0
- data/.idea/workspace.xml +14 -0
- data/.rubocop.yml +1 -1
- data/Gemfile +0 -1
- data/legion-logging.gemspec +3 -2
- data/lib/legion/logging.rb +0 -4
- data/lib/legion/logging/builder.rb +4 -22
- data/lib/legion/logging/logger.rb +7 -10
- data/lib/legion/logging/methods.rb +0 -39
- data/lib/legion/logging/version.rb +1 -1
- metadata +31 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2b6f8eb657b6f10e4a02806f4faa9f2d50788a0aad4f2b64ca87b9836472d78
|
4
|
+
data.tar.gz: cac716412021a31196391741bd02a8304bcbde0da67216b078b36825e5d9f532
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa80f207159a21c67a6624478f83bd4cae0c2dc850f50e56b0b0b594d6e6f345e6f38b047ddced0bdc08ee43ee24447858e3c9a3b4bdc72070f3479e148351ff
|
7
|
+
data.tar.gz: 9675b5e00fae346f39c23abd658029389d5584ce48be3b504b99461cd3086f14cb3588cd2e23e32bd0061f971bf14929ca1336dccfd7eee9b3c42a44068ba70a
|
data/.circleci/config.yml
CHANGED
@@ -1,61 +1,167 @@
|
|
1
|
-
version: 2.
|
2
|
-
orbs:
|
3
|
-
ruby: circleci/ruby@0.2.1
|
4
|
-
|
1
|
+
version: 2 # use CircleCI 2.0
|
5
2
|
jobs:
|
6
3
|
"rubocop":
|
7
4
|
docker:
|
8
|
-
- image: circleci/ruby:2.
|
5
|
+
- image: circleci/ruby:2.4-node
|
9
6
|
steps:
|
10
7
|
- checkout
|
11
|
-
-
|
12
|
-
- ruby/install-deps
|
8
|
+
- run: gem install rubocop
|
13
9
|
- run:
|
14
10
|
name: Run Rubocop
|
15
|
-
command:
|
16
|
-
-
|
17
|
-
|
11
|
+
command: rubocop
|
12
|
+
- store_test_results:
|
13
|
+
path: test_results
|
14
|
+
"ruby-2.0":
|
15
|
+
docker:
|
16
|
+
- image: circleci/ruby:2.0
|
17
|
+
steps:
|
18
|
+
- checkout
|
19
|
+
- run:
|
20
|
+
name: Bundle Install
|
21
|
+
command: bundle install
|
22
|
+
- run:
|
23
|
+
name: Run RSpec
|
24
|
+
command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
|
25
|
+
when: always
|
26
|
+
- store_test_results:
|
27
|
+
path: test-results
|
28
|
+
"ruby-2.1":
|
29
|
+
docker:
|
30
|
+
- image: circleci/ruby:2.1
|
31
|
+
steps:
|
32
|
+
- checkout
|
33
|
+
- run:
|
34
|
+
name: Bundle Install
|
35
|
+
command: bundle install
|
36
|
+
- run:
|
37
|
+
name: Run RSpec
|
38
|
+
command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
|
39
|
+
when: always
|
40
|
+
- store_test_results:
|
41
|
+
path: test-results
|
42
|
+
"ruby-2.2":
|
43
|
+
docker:
|
44
|
+
- image: circleci/ruby:2.2
|
45
|
+
steps:
|
46
|
+
- checkout
|
47
|
+
- run:
|
48
|
+
name: Bundle Install
|
49
|
+
command: bundle install
|
50
|
+
- run:
|
51
|
+
name: Run RSpec
|
52
|
+
command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
|
53
|
+
when: always
|
54
|
+
- store_test_results:
|
55
|
+
path: test-results
|
56
|
+
|
57
|
+
"ruby-2.3":
|
58
|
+
docker:
|
59
|
+
- image: circleci/ruby:2.3
|
60
|
+
steps:
|
61
|
+
- checkout
|
62
|
+
- run:
|
63
|
+
name: Bundle Install
|
64
|
+
command: bundle install
|
65
|
+
- run:
|
66
|
+
name: Run RSpec
|
67
|
+
command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
|
68
|
+
when: always
|
69
|
+
- store_test_results:
|
70
|
+
path: test-results
|
71
|
+
|
72
|
+
"ruby-2.4":
|
18
73
|
docker:
|
19
|
-
- image: circleci/ruby:2.
|
20
|
-
- image: memcached:1.5-alpine
|
74
|
+
- image: circleci/ruby:2.4-node
|
21
75
|
steps:
|
22
76
|
- checkout
|
23
|
-
-
|
24
|
-
|
25
|
-
|
26
|
-
-
|
27
|
-
|
77
|
+
- run:
|
78
|
+
name: Bundle Install
|
79
|
+
command: bundle install
|
80
|
+
- run:
|
81
|
+
name: Run RSpec
|
82
|
+
command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
|
83
|
+
when: always
|
84
|
+
- store_test_results:
|
85
|
+
path: test-results
|
86
|
+
"ruby-2.5":
|
28
87
|
docker:
|
29
|
-
- image: circleci/ruby:2.
|
30
|
-
- image: memcached:1.5-alpine
|
88
|
+
- image: circleci/ruby:2.5-node
|
31
89
|
steps:
|
32
90
|
- checkout
|
33
|
-
-
|
34
|
-
|
35
|
-
|
36
|
-
-
|
37
|
-
|
91
|
+
- run:
|
92
|
+
name: Bundle Install
|
93
|
+
command: bundle install
|
94
|
+
- run:
|
95
|
+
name: Run RSpec
|
96
|
+
command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
|
97
|
+
when: always
|
98
|
+
- store_test_results:
|
99
|
+
path: test-results
|
100
|
+
"ruby-2.6":
|
38
101
|
docker:
|
39
|
-
- image: circleci/ruby:2.
|
40
|
-
- image: memcached:1.5-alpine
|
102
|
+
- image: circleci/ruby:2.6-node
|
41
103
|
steps:
|
42
104
|
- checkout
|
43
|
-
-
|
44
|
-
|
45
|
-
|
46
|
-
-
|
105
|
+
- run:
|
106
|
+
name: Bundle Install
|
107
|
+
command: bundle install
|
108
|
+
- run:
|
109
|
+
name: Run RSpec
|
110
|
+
command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
|
111
|
+
when: always
|
112
|
+
- store_test_results:
|
113
|
+
path: test-results
|
114
|
+
"jruby-9.2":
|
115
|
+
docker:
|
116
|
+
- image: circleci/jruby:9.2
|
117
|
+
steps:
|
118
|
+
- checkout
|
119
|
+
- run:
|
120
|
+
name: Bundle Install
|
121
|
+
command: bundle install
|
122
|
+
- run:
|
123
|
+
name: Run RSpec
|
124
|
+
command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
|
125
|
+
when: always
|
126
|
+
- store_test_results:
|
127
|
+
path: test-results
|
47
128
|
|
48
129
|
workflows:
|
49
130
|
version: 2
|
50
|
-
|
131
|
+
cop_rake_deploy:
|
51
132
|
jobs:
|
52
133
|
- rubocop
|
53
|
-
- ruby-
|
134
|
+
# - ruby-2.2:
|
135
|
+
# requires:
|
136
|
+
# - ruby-2.4
|
137
|
+
# filters:
|
138
|
+
# branches:
|
139
|
+
# only: /\bdevelop\b|\bmaster\b/
|
140
|
+
- ruby-2.3:
|
141
|
+
requires:
|
142
|
+
- ruby-2.4
|
143
|
+
filters:
|
144
|
+
branches:
|
145
|
+
only: /\bdevelop\b|\bmaster\b/
|
146
|
+
- ruby-2.4:
|
54
147
|
requires:
|
55
148
|
- rubocop
|
56
|
-
- ruby-
|
149
|
+
- ruby-2.5:
|
150
|
+
requires:
|
151
|
+
- ruby-2.4
|
152
|
+
filters:
|
153
|
+
branches:
|
154
|
+
only: /\bdevelop\b|\bmaster\b/
|
155
|
+
- ruby-2.6:
|
57
156
|
requires:
|
58
|
-
- ruby-
|
59
|
-
|
157
|
+
- ruby-2.4
|
158
|
+
filters:
|
159
|
+
branches:
|
160
|
+
only: /\bdevelop\b|\bmaster\b/
|
161
|
+
- jruby-9.2:
|
60
162
|
requires:
|
61
|
-
|
163
|
+
#- ruby-2.2
|
164
|
+
- ruby-2.3
|
165
|
+
- ruby-2.4
|
166
|
+
- ruby-2.5
|
167
|
+
- ruby-2.6
|
data/.idea/.rakeTasks
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<Settings><!--This file was automatically generated by Ruby plugin.
|
3
|
+
You are allowed to:
|
4
|
+
1. Remove rake task
|
5
|
+
2. Add existing rake tasks
|
6
|
+
To add existing rake tasks automatically delete this file and reload the project.
|
7
|
+
--><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build legion-logging-0.1.3.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Remove any temporary products" fullCmd="clean" taksId="clean" /><RakeTask description="Remove any generated files" fullCmd="clobber" taksId="clobber" /><RakeTask description="Build and install legion-logging-0.1.3.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install legion-logging-0.1.3.gem into system gems without network access" fullCmd="install:local" taksId="local" /></RakeGroup><RakeTask description="Create tag v0.1.3 and build and push legion-logging-0.1.3.gem to rubygems.org" fullCmd="release[remote]" taksId="release[remote]" /><RakeTask description="Run RSpec code examples" fullCmd="spec" taksId="spec" /><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="ModuleRunConfigurationManager">
|
4
|
+
<shared />
|
5
|
+
</component>
|
6
|
+
<component name="NewModuleRootManager">
|
7
|
+
<content url="file://$MODULE_DIR$" />
|
8
|
+
<orderEntry type="inheritedJdk" />
|
9
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
10
|
+
<orderEntry type="library" scope="PROVIDED" name="ast (v2.4.0, RVM: ruby-2.6.3) [gem]" level="application" />
|
11
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.1.4, RVM: ruby-2.6.3) [gem]" level="application" />
|
12
|
+
<orderEntry type="library" scope="PROVIDED" name="codecov (v0.1.16, RVM: ruby-2.6.3) [gem]" level="application" />
|
13
|
+
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.3, RVM: ruby-2.6.3) [gem]" level="application" />
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="docile (v1.3.2, RVM: ruby-2.6.3) [gem]" level="application" />
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="jaro_winkler (v1.5.4, RVM: ruby-2.6.3) [gem]" level="application" />
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="json (v2.3.0, RVM: ruby-2.6.3) [gem]" level="application" />
|
17
|
+
<orderEntry type="library" scope="PROVIDED" name="logger (v1.4.2, RVM: ruby-2.6.3) [gem]" level="application" />
|
18
|
+
<orderEntry type="library" scope="PROVIDED" name="parallel (v1.19.1, RVM: ruby-2.6.3) [gem]" level="application" />
|
19
|
+
<orderEntry type="library" scope="PROVIDED" name="parser (v2.7.0.4, RVM: ruby-2.6.3) [gem]" level="application" />
|
20
|
+
<orderEntry type="library" scope="PROVIDED" name="rainbow (v3.0.0, RVM: ruby-2.6.3) [gem]" level="application" />
|
21
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v10.5.0, RVM: ruby-2.6.3) [gem]" level="application" />
|
22
|
+
<orderEntry type="library" scope="PROVIDED" name="rexml (v3.2.4, RVM: ruby-2.6.3) [gem]" level="application" />
|
23
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.9.0, RVM: ruby-2.6.3) [gem]" level="application" />
|
24
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.9.1, RVM: ruby-2.6.3) [gem]" level="application" />
|
25
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.9.0, RVM: ruby-2.6.3) [gem]" level="application" />
|
26
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.9.1, RVM: ruby-2.6.3) [gem]" level="application" />
|
27
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.9.2, RVM: ruby-2.6.3) [gem]" level="application" />
|
28
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec_junit_formatter (v0.4.1, RVM: ruby-2.6.3) [gem]" level="application" />
|
29
|
+
<orderEntry type="library" scope="PROVIDED" name="rubocop (v0.80.1, RVM: ruby-2.6.3) [gem]" level="application" />
|
30
|
+
<orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.10.1, RVM: ruby-2.6.3) [gem]" level="application" />
|
31
|
+
<orderEntry type="library" scope="PROVIDED" name="simplecov (v0.18.5, RVM: ruby-2.6.3) [gem]" level="application" />
|
32
|
+
<orderEntry type="library" scope="PROVIDED" name="simplecov-html (v0.12.2, RVM: ruby-2.6.3) [gem]" level="application" />
|
33
|
+
<orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v1.6.1, RVM: ruby-2.6.3) [gem]" level="application" />
|
34
|
+
<orderEntry type="library" scope="PROVIDED" name="url (v0.3.2, RVM: ruby-2.6.3) [gem]" level="application" />
|
35
|
+
</component>
|
36
|
+
</module>
|
data/.idea/misc.xml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="JavaScriptSettings">
|
4
|
+
<option name="languageLevel" value="ES6" />
|
5
|
+
</component>
|
6
|
+
<component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-2.6.3" project-jdk-type="RUBY_SDK" />
|
7
|
+
</project>
|
data/.idea/modules.xml
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ProjectModuleManager">
|
4
|
+
<modules>
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/legion-logging.iml" filepath="$PROJECT_DIR$/.idea/legion-logging.iml" />
|
6
|
+
</modules>
|
7
|
+
</component>
|
8
|
+
</project>
|
data/.idea/vagrant.xml
ADDED
data/.idea/workspace.xml
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="CoverageOptionsProvider">
|
4
|
+
<option name="myAddOrReplace" value="0" />
|
5
|
+
</component>
|
6
|
+
<component name="Git.Settings">
|
7
|
+
<option name="PUSH_AUTO_UPDATE" value="true" />
|
8
|
+
<option name="ROOT_SYNC" value="DONT_SYNC" />
|
9
|
+
</component>
|
10
|
+
<component name="ProjectId" id="1Yl3Ni6NlUlB0HwEdc23TcNXMXO" />
|
11
|
+
<component name="PropertiesComponent">
|
12
|
+
<property name="settings.editor.selected.configurable" value="reference.settingsdialog.project.vagrant" />
|
13
|
+
</component>
|
14
|
+
</project>
|
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
data/legion-logging.gemspec
CHANGED
@@ -28,11 +28,12 @@ Gem::Specification.new do |spec|
|
|
28
28
|
|
29
29
|
spec.add_development_dependency 'bundler'
|
30
30
|
spec.add_development_dependency 'codecov'
|
31
|
-
spec.add_development_dependency 'rake'
|
32
|
-
spec.add_development_dependency 'rspec'
|
31
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
32
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
33
33
|
spec.add_development_dependency 'rspec_junit_formatter'
|
34
34
|
spec.add_development_dependency 'rubocop'
|
35
35
|
spec.add_development_dependency 'simplecov'
|
36
36
|
|
37
|
+
spec.add_dependency 'logger', '~> 1.3'
|
37
38
|
spec.add_dependency 'rainbow', '~> 3'
|
38
39
|
end
|
data/lib/legion/logging.rb
CHANGED
@@ -1,25 +1,9 @@
|
|
1
1
|
module Legion
|
2
2
|
module Logging
|
3
3
|
module Builder
|
4
|
-
def log_format(
|
4
|
+
def log_format(_options = {}, log = @log)
|
5
5
|
log.formatter = proc do |severity, datetime, _progname, msg|
|
6
|
-
|
7
|
-
unless options[:lex_name].nil?
|
8
|
-
data = caller_locations[4].to_s.split('/').last(2)
|
9
|
-
runner_trace = {
|
10
|
-
type: data[0],
|
11
|
-
file: file = data[1].split('.')[0], # rubocop:disable Lint/UselessAssignment
|
12
|
-
function: data[1].split('`')[1].delete_suffix('\''),
|
13
|
-
line_number: line_number = data[1].split(':')[1] # rubocop:disable Lint/UselessAssignment
|
14
|
-
}
|
15
|
-
end
|
16
|
-
string = "[#{datetime}][#{::Process.pid}]"
|
17
|
-
string.concat(options[:lex_name]) unless options[:lex_name].nil?
|
18
|
-
if runner_trace.is_a?(Hash) && options[:extended]
|
19
|
-
string.concat("[#{runner_trace[:file]}:#{runner_trace[:line_number]}]")
|
20
|
-
end
|
21
|
-
string.concat(" #{severity} #{msg}\n")
|
22
|
-
string
|
6
|
+
"[#{datetime}][#{::Process.pid}] #{severity} #{msg}\n"
|
23
7
|
end
|
24
8
|
end
|
25
9
|
|
@@ -28,10 +12,8 @@ module Legion
|
|
28
12
|
@log = ::Logger.new(options[:log_file]) unless options[:log_file].nil?
|
29
13
|
end
|
30
14
|
|
31
|
-
def log_level(level = 'debug', log = @log)
|
32
|
-
if level == '
|
33
|
-
log.level = ::Logger::INFO
|
34
|
-
elsif level == 'debug'
|
15
|
+
def log_level(level = 'debug', log = @log)
|
16
|
+
if level == 'debug'
|
35
17
|
log.level = ::Logger::DEBUG
|
36
18
|
elsif level == 'info'
|
37
19
|
log.level = ::Logger::INFO
|
@@ -4,19 +4,16 @@ require 'legion/logging/builder'
|
|
4
4
|
module Legion
|
5
5
|
module Logging
|
6
6
|
class Logger
|
7
|
-
|
7
|
+
attr_reader :log, :color
|
8
8
|
include Legion::Logging::Methods
|
9
9
|
include Legion::Logging::Builder
|
10
10
|
|
11
|
-
def initialize(
|
12
|
-
output(
|
13
|
-
log_level(level)
|
14
|
-
log_format(
|
15
|
-
@color =
|
16
|
-
@color = true if
|
17
|
-
@trace_enabled = trace
|
18
|
-
@trace_size = trace_size
|
19
|
-
@extended = extended
|
11
|
+
def initialize(options = {})
|
12
|
+
output(options)
|
13
|
+
log_level(options[:level])
|
14
|
+
log_format(options)
|
15
|
+
@color = options[:color]
|
16
|
+
@color = true if options[:color].nil? && options[:log_file].nil?
|
20
17
|
end
|
21
18
|
end
|
22
19
|
end
|
@@ -1,55 +1,31 @@
|
|
1
1
|
module Legion
|
2
2
|
module Logging
|
3
3
|
module Methods
|
4
|
-
def trace(raw_message = nil, log = @log, size: @trace_size, log_caller: true) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/AbcSize
|
5
|
-
return unless @trace_enabled
|
6
|
-
|
7
|
-
raw_message = yield if raw_message.nil? && block_given?
|
8
|
-
message = Rainbow('Tracing: ').cyan
|
9
|
-
message.concat Rainbow(raw_message + ' ').cyan
|
10
|
-
if log_caller && size.nil?
|
11
|
-
message.concat Rainbow(caller_locations).cyan.underline
|
12
|
-
elsif log_caller
|
13
|
-
message.concat Rainbow(caller_locations[0..size]).cyan.underline
|
14
|
-
end
|
15
|
-
log.unknown(message)
|
16
|
-
end
|
17
|
-
|
18
4
|
def debug(message = nil, log = @log)
|
19
|
-
return unless log.level < 1
|
20
|
-
|
21
5
|
message = yield if message.nil? && block_given?
|
22
6
|
message = Rainbow(message).blue if @color
|
23
7
|
log.debug(message)
|
24
8
|
end
|
25
9
|
|
26
10
|
def info(message = nil, log = @log)
|
27
|
-
return unless log.level < 2
|
28
|
-
|
29
11
|
message = yield if message.nil? && block_given?
|
30
12
|
message = Rainbow(message).green if @color
|
31
13
|
log.info(message)
|
32
14
|
end
|
33
15
|
|
34
16
|
def warn(message = nil, log = @log)
|
35
|
-
return unless log.level < 3
|
36
|
-
|
37
17
|
message = yield if message.nil? && block_given?
|
38
18
|
message = Rainbow(message).yellow if @color
|
39
19
|
log.warn(message)
|
40
20
|
end
|
41
21
|
|
42
22
|
def error(message = nil, log = @log)
|
43
|
-
return unless log.level < 4
|
44
|
-
|
45
23
|
message = yield if message.nil? && block_given?
|
46
24
|
message = Rainbow(message).red if @color
|
47
25
|
log.error(message)
|
48
26
|
end
|
49
27
|
|
50
28
|
def fatal(message = nil, log = @log)
|
51
|
-
return unless log.level < 5
|
52
|
-
|
53
29
|
message = yield if message.nil? && block_given?
|
54
30
|
message = Rainbow(message).darkred if @color
|
55
31
|
log.fatal(message)
|
@@ -60,21 +36,6 @@ module Legion
|
|
60
36
|
message = Rainbow(message).purple if @color
|
61
37
|
log.unknown(message)
|
62
38
|
end
|
63
|
-
|
64
|
-
def runner_exception(exc, **opts)
|
65
|
-
Legion::Logging.error exc.message
|
66
|
-
Legion::Logging.error exc.backtrace
|
67
|
-
Legion::Logging.error opts
|
68
|
-
{ success: false, message: exc.message, backtrace: exc.backtrace }.merge(opts)
|
69
|
-
end
|
70
|
-
|
71
|
-
def thread(kvl: false)
|
72
|
-
if kvl
|
73
|
-
"thread=#{Thread.current.object_id}"
|
74
|
-
else
|
75
|
-
Thread.current.object_id.to_s
|
76
|
-
end
|
77
|
-
end
|
78
39
|
end
|
79
40
|
end
|
80
41
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: legion-logging
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esity
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -42,30 +42,30 @@ dependencies:
|
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
47
|
+
version: '10.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
54
|
+
version: '10.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
61
|
+
version: '3.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
68
|
+
version: '3.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec_junit_formatter
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: logger
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '1.3'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '1.3'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: rainbow
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -131,6 +145,12 @@ extra_rdoc_files: []
|
|
131
145
|
files:
|
132
146
|
- ".circleci/config.yml"
|
133
147
|
- ".gitignore"
|
148
|
+
- ".idea/.rakeTasks"
|
149
|
+
- ".idea/legion-logging.iml"
|
150
|
+
- ".idea/misc.xml"
|
151
|
+
- ".idea/modules.xml"
|
152
|
+
- ".idea/vagrant.xml"
|
153
|
+
- ".idea/workspace.xml"
|
134
154
|
- ".rubocop.yml"
|
135
155
|
- CHANGELOG.md
|
136
156
|
- Gemfile
|
@@ -167,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
187
|
- !ruby/object:Gem::Version
|
168
188
|
version: '0'
|
169
189
|
requirements: []
|
170
|
-
rubygems_version: 3.0.
|
190
|
+
rubygems_version: 3.0.8
|
171
191
|
signing_key:
|
172
192
|
specification_version: 4
|
173
193
|
summary: The Legion::Logging class
|