legion-logging 0.3.1 → 1.1.3
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 +53 -137
- data/.gitignore +1 -0
- data/.rubocop.yml +5 -2
- data/CHANGELOG.md +4 -0
- data/bitbucket-pipelines.yml +14 -29
- data/legion-logging.gemspec +5 -6
- data/lib/legion/logging.rb +3 -3
- data/lib/legion/logging/builder.rb +53 -14
- data/lib/legion/logging/logger.rb +11 -7
- data/lib/legion/logging/methods.rb +45 -6
- data/lib/legion/logging/version.rb +1 -1
- data/sonar-project.properties +12 -0
- metadata +25 -29
- data/.idea/.rakeTasks +0 -7
- data/.idea/legion-logging.iml +0 -36
- data/.idea/misc.xml +0 -7
- data/.idea/modules.xml +0 -8
- data/.idea/vagrant.xml +0 -7
- data/.idea/workspace.xml +0 -14
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2c23b52e80d98a8fe9dd57a6c035ae3a1dbf944c36df1dcb75e4a40579cc6877
|
|
4
|
+
data.tar.gz: f033aaa8333c5b732bf8d7fea044f3b1a763f93e1e6e6f505fd96bbe5c3fa9f3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b41978935615219e45cdf4df3c3c519fd2a5bcce8a56b435f6b582e6d0ae7c54ec76ca31aa1da431f705909572c1afccfd59b91979e9d934559a5ac4180a8b2a
|
|
7
|
+
data.tar.gz: 2ab09da5cb65c19b11ea68501b96bf358ad2d3c1db6fe590460e5cdf242f63b6de0a9987a67c31e9bafbf0e6c9287f9255db273f180d12d8fb8cc7c6fb338db2
|
data/.circleci/config.yml
CHANGED
|
@@ -1,167 +1,83 @@
|
|
|
1
|
-
version: 2
|
|
1
|
+
version: 2.1
|
|
2
|
+
orbs:
|
|
3
|
+
ruby: circleci/ruby@0.2.1
|
|
4
|
+
sonarcloud: sonarsource/sonarcloud@1.0.1
|
|
5
|
+
|
|
2
6
|
jobs:
|
|
3
7
|
"rubocop":
|
|
4
8
|
docker:
|
|
5
|
-
- image: circleci/ruby:2.
|
|
9
|
+
- image: circleci/ruby:2.7-node
|
|
6
10
|
steps:
|
|
7
11
|
- checkout
|
|
8
|
-
-
|
|
12
|
+
- ruby/load-cache
|
|
13
|
+
- ruby/install-deps
|
|
9
14
|
- run:
|
|
10
15
|
name: Run Rubocop
|
|
11
|
-
command: rubocop
|
|
12
|
-
-
|
|
13
|
-
|
|
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":
|
|
16
|
+
command: bundle exec rubocop
|
|
17
|
+
- ruby/save-cache
|
|
18
|
+
"ruby-two-five":
|
|
73
19
|
docker:
|
|
74
|
-
- image: circleci/ruby:2.
|
|
20
|
+
- image: circleci/ruby:2.5
|
|
75
21
|
steps:
|
|
76
22
|
- checkout
|
|
77
|
-
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
path: test-results
|
|
86
|
-
"ruby-2.5":
|
|
23
|
+
- ruby/load-cache
|
|
24
|
+
- run:
|
|
25
|
+
name: update bundler
|
|
26
|
+
command: gem update bundler
|
|
27
|
+
- ruby/install-deps
|
|
28
|
+
- ruby/run-tests
|
|
29
|
+
- ruby/save-cache
|
|
30
|
+
"ruby-two-six":
|
|
87
31
|
docker:
|
|
88
|
-
- image: circleci/ruby:2.
|
|
32
|
+
- image: circleci/ruby:2.6
|
|
89
33
|
steps:
|
|
90
34
|
- checkout
|
|
91
|
-
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
path: test-results
|
|
100
|
-
"ruby-2.6":
|
|
35
|
+
- ruby/load-cache
|
|
36
|
+
- run:
|
|
37
|
+
name: update bundler
|
|
38
|
+
command: gem update bundler
|
|
39
|
+
- ruby/install-deps
|
|
40
|
+
- ruby/run-tests
|
|
41
|
+
- ruby/save-cache
|
|
42
|
+
"ruby-two-seven":
|
|
101
43
|
docker:
|
|
102
|
-
- image: circleci/ruby:2.
|
|
44
|
+
- image: circleci/ruby:2.7
|
|
45
|
+
- image: memcached:1.5-alpine
|
|
103
46
|
steps:
|
|
104
47
|
- checkout
|
|
105
|
-
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
-
|
|
109
|
-
|
|
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":
|
|
48
|
+
- ruby/load-cache
|
|
49
|
+
- ruby/install-deps
|
|
50
|
+
- ruby/run-tests
|
|
51
|
+
- ruby/save-cache
|
|
52
|
+
"sonarcloud":
|
|
115
53
|
docker:
|
|
116
|
-
- image: circleci/
|
|
54
|
+
- image: circleci/ruby:2.7
|
|
117
55
|
steps:
|
|
118
56
|
- checkout
|
|
57
|
+
- ruby/load-cache
|
|
58
|
+
- ruby/install-deps
|
|
59
|
+
- ruby/run-tests
|
|
119
60
|
- run:
|
|
120
|
-
name:
|
|
121
|
-
command: bundle
|
|
122
|
-
-
|
|
123
|
-
|
|
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
|
|
61
|
+
name: Run Rubocop
|
|
62
|
+
command: bundle exec rubocop --format=json --out=rubocop-result.json
|
|
63
|
+
- sonarcloud/scan
|
|
64
|
+
- ruby/save-cache
|
|
128
65
|
|
|
129
66
|
workflows:
|
|
130
67
|
version: 2
|
|
131
|
-
|
|
68
|
+
rubocop-rspec:
|
|
132
69
|
jobs:
|
|
133
70
|
- rubocop
|
|
134
|
-
|
|
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:
|
|
71
|
+
- ruby-two-five:
|
|
147
72
|
requires:
|
|
148
73
|
- rubocop
|
|
149
|
-
- ruby-
|
|
74
|
+
- ruby-two-six:
|
|
150
75
|
requires:
|
|
151
|
-
- ruby-
|
|
152
|
-
|
|
153
|
-
branches:
|
|
154
|
-
only: /\bdevelop\b|\bmaster\b/
|
|
155
|
-
- ruby-2.6:
|
|
76
|
+
- ruby-two-five
|
|
77
|
+
- ruby-two-seven:
|
|
156
78
|
requires:
|
|
157
|
-
- ruby-
|
|
158
|
-
|
|
159
|
-
branches:
|
|
160
|
-
only: /\bdevelop\b|\bmaster\b/
|
|
161
|
-
- jruby-9.2:
|
|
79
|
+
- ruby-two-five
|
|
80
|
+
- sonarcloud:
|
|
162
81
|
requires:
|
|
163
|
-
|
|
164
|
-
- ruby-
|
|
165
|
-
- ruby-2.4
|
|
166
|
-
- ruby-2.5
|
|
167
|
-
- ruby-2.6
|
|
82
|
+
- ruby-two-seven
|
|
83
|
+
- ruby-two-six
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
Layout/LineLength:
|
|
2
2
|
Max: 120
|
|
3
3
|
Metrics/MethodLength:
|
|
4
4
|
Max: 30
|
|
5
5
|
Metrics/ClassLength:
|
|
6
6
|
Max: 1500
|
|
7
7
|
Metrics/BlockLength:
|
|
8
|
-
Max:
|
|
8
|
+
Max: 75
|
|
9
|
+
Metrics/CyclomaticComplexity:
|
|
10
|
+
Max: 10
|
|
9
11
|
Layout/SpaceAroundEqualsInParameterDefault:
|
|
10
12
|
EnforcedStyle: space
|
|
11
13
|
Style/SymbolArray:
|
|
@@ -17,5 +19,6 @@ Style/Documentation:
|
|
|
17
19
|
Enabled: false
|
|
18
20
|
AllCops:
|
|
19
21
|
TargetRubyVersion: 2.5
|
|
22
|
+
NewCops: enable
|
|
20
23
|
Style/FrozenStringLiteralComment:
|
|
21
24
|
Enabled: false
|
data/CHANGELOG.md
CHANGED
data/bitbucket-pipelines.yml
CHANGED
|
@@ -1,33 +1,18 @@
|
|
|
1
|
-
image: ruby:2.
|
|
1
|
+
image: ruby:2.7.0
|
|
2
2
|
|
|
3
3
|
pipelines:
|
|
4
4
|
branches:
|
|
5
5
|
master:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
- bundle install
|
|
20
|
-
- gem build legion-logging.gemspec
|
|
21
|
-
- gem inabox legion-logging*.gem -g https://gems.whonodes.org/ -o
|
|
22
|
-
default:
|
|
23
|
-
- step:
|
|
24
|
-
caches:
|
|
25
|
-
- bundler
|
|
26
|
-
script:
|
|
27
|
-
- gem install bundle rubocop
|
|
28
|
-
- bundle install
|
|
29
|
-
- rubocop
|
|
30
|
-
- rake
|
|
31
|
-
definitions:
|
|
32
|
-
caches:
|
|
33
|
-
bundler: vendor/bundle
|
|
6
|
+
- step:
|
|
7
|
+
name: Push to RubyGems
|
|
8
|
+
deployment: RubyGems
|
|
9
|
+
script:
|
|
10
|
+
- gem install bundler gem-release rake rspec
|
|
11
|
+
- bundle install
|
|
12
|
+
- rake build
|
|
13
|
+
- mkdir .gem
|
|
14
|
+
- (umask 077 ; echo $gem_creds | base64 --decode > .gem/credentials)
|
|
15
|
+
- gem release
|
|
16
|
+
- gem tag --push
|
|
17
|
+
artifacts:
|
|
18
|
+
- pkg/**
|
data/legion-logging.gemspec
CHANGED
|
@@ -18,22 +18,21 @@ Gem::Specification.new do |spec|
|
|
|
18
18
|
spec.metadata['homepage_uri'] = 'https://bitbucket.org/legion-io/legion-logging'
|
|
19
19
|
spec.metadata['source_code_uri'] = 'https://bitbucket.org/legion-io/legion-logging'
|
|
20
20
|
spec.metadata['wiki_uri'] = 'https://bitbucket.org/legion-io/legion-logging/wiki/Home'
|
|
21
|
-
|
|
21
|
+
spec.required_ruby_version = '>= 2.5.0'
|
|
22
22
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
23
23
|
f.match(%r{^(test|spec|features)/})
|
|
24
24
|
end
|
|
25
|
-
spec.bindir = 'exe'
|
|
26
25
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
27
26
|
spec.require_paths = ['lib']
|
|
28
27
|
|
|
29
28
|
spec.add_development_dependency 'bundler'
|
|
30
29
|
spec.add_development_dependency 'codecov'
|
|
31
|
-
spec.add_development_dependency 'rake'
|
|
32
|
-
spec.add_development_dependency 'rspec'
|
|
30
|
+
spec.add_development_dependency 'rake'
|
|
31
|
+
spec.add_development_dependency 'rspec'
|
|
33
32
|
spec.add_development_dependency 'rspec_junit_formatter'
|
|
34
33
|
spec.add_development_dependency 'rubocop'
|
|
35
|
-
spec.add_development_dependency '
|
|
34
|
+
spec.add_development_dependency 'rubocop-performance'
|
|
35
|
+
spec.add_development_dependency 'simplecov', '< 0.18.0'
|
|
36
36
|
|
|
37
|
-
spec.add_dependency 'logger', '~> 1.3'
|
|
38
37
|
spec.add_dependency 'rainbow', '~> 3'
|
|
39
38
|
end
|
data/lib/legion/logging.rb
CHANGED
|
@@ -11,11 +11,11 @@ module Legion
|
|
|
11
11
|
class << self
|
|
12
12
|
include Legion::Logging::Methods
|
|
13
13
|
include Legion::Logging::Builder
|
|
14
|
-
attr_reader :
|
|
14
|
+
attr_reader :color
|
|
15
15
|
|
|
16
|
-
def setup(
|
|
16
|
+
def setup(level: 'info', **options)
|
|
17
17
|
output(options)
|
|
18
|
-
log_level(
|
|
18
|
+
log_level(level)
|
|
19
19
|
log_format(options)
|
|
20
20
|
@color = options[:color]
|
|
21
21
|
@color = true if options[:color].nil? && options[:log_file].nil?
|
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
module Legion
|
|
2
2
|
module Logging
|
|
3
3
|
module Builder
|
|
4
|
-
def log_format(
|
|
4
|
+
def log_format(options = {}) # rubocop:disable Metrics/AbcSize
|
|
5
5
|
log.formatter = proc do |severity, datetime, _progname, msg|
|
|
6
|
-
"[
|
|
6
|
+
options[:lex_name] = options.key?(:lex) ? "[lex-#{options[:lex]}]" : nil
|
|
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: data[1].split('.')[0],
|
|
12
|
+
function: data[1].split('`')[1].delete_suffix('\''),
|
|
13
|
+
line_number: data[1].split(':')[1]
|
|
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] || severity == 'debug')
|
|
19
|
+
string.concat("[#{runner_trace[:type]}:#{runner_trace[:file]}:#{runner_trace[:line_number]}]")
|
|
20
|
+
end
|
|
21
|
+
string.concat(" #{severity} #{msg}\n")
|
|
22
|
+
string
|
|
7
23
|
end
|
|
8
24
|
end
|
|
9
25
|
|
|
@@ -12,18 +28,41 @@ module Legion
|
|
|
12
28
|
@log = ::Logger.new(options[:log_file]) unless options[:log_file].nil?
|
|
13
29
|
end
|
|
14
30
|
|
|
15
|
-
def
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
31
|
+
def log
|
|
32
|
+
@log ||= set_log
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def set_log(logfile: nil, **)
|
|
36
|
+
@log = logfile.nil? ? ::Logger.new($stdout) : ::Logger.new(logfile)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def level
|
|
40
|
+
log.level
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def log_level(level = 'info')
|
|
44
|
+
log.level = case level
|
|
45
|
+
when 'trace'
|
|
46
|
+
::Logger::DEBUG
|
|
47
|
+
when 'debug'
|
|
48
|
+
::Logger::DEBUG
|
|
49
|
+
when 'info'
|
|
50
|
+
::Logger::INFO
|
|
51
|
+
when 'warn'
|
|
52
|
+
::Logger::WARN
|
|
53
|
+
when 'error'
|
|
54
|
+
::Logger::ERROR
|
|
55
|
+
when 'fatal'
|
|
56
|
+
::Logger::FATAL
|
|
57
|
+
when nil
|
|
58
|
+
42
|
|
59
|
+
else
|
|
60
|
+
if level.is_a? Integer
|
|
61
|
+
level
|
|
62
|
+
else
|
|
63
|
+
0
|
|
64
|
+
end
|
|
65
|
+
end
|
|
27
66
|
@log = log
|
|
28
67
|
end
|
|
29
68
|
end
|
|
@@ -4,16 +4,20 @@ require 'legion/logging/builder'
|
|
|
4
4
|
module Legion
|
|
5
5
|
module Logging
|
|
6
6
|
class Logger
|
|
7
|
-
|
|
7
|
+
attr_accessor :log, :color, :level, :lex, :log_file, :trace_enabled, :extended
|
|
8
|
+
|
|
8
9
|
include Legion::Logging::Methods
|
|
9
10
|
include Legion::Logging::Builder
|
|
10
11
|
|
|
11
|
-
def initialize(
|
|
12
|
-
|
|
13
|
-
log_level(
|
|
14
|
-
log_format(
|
|
15
|
-
@color =
|
|
16
|
-
@color = true if
|
|
12
|
+
def initialize(level: 'info', log_file: nil, lex: nil, trace: false, extended: false, trace_size: 4, **opts) # rubocop:disable Metrics/ParameterLists
|
|
13
|
+
set_log(logfile: log_file)
|
|
14
|
+
log_level(level)
|
|
15
|
+
log_format(lex: lex, extended: extended, **opts)
|
|
16
|
+
@color = opts[:color]
|
|
17
|
+
@color = true if opts[:color].nil? && log_file.nil?
|
|
18
|
+
@trace_enabled = trace
|
|
19
|
+
@trace_size = trace_size
|
|
20
|
+
@extended = extended
|
|
17
21
|
end
|
|
18
22
|
end
|
|
19
23
|
end
|
|
@@ -1,41 +1,80 @@
|
|
|
1
1
|
module Legion
|
|
2
2
|
module Logging
|
|
3
3
|
module Methods
|
|
4
|
-
def
|
|
4
|
+
def trace(raw_message = nil, size: @trace_size, log_caller: true) # rubocop:disable 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
|
+
def debug(message = nil)
|
|
19
|
+
return unless log.level < 1
|
|
20
|
+
|
|
5
21
|
message = yield if message.nil? && block_given?
|
|
6
22
|
message = Rainbow(message).blue if @color
|
|
7
23
|
log.debug(message)
|
|
8
24
|
end
|
|
9
25
|
|
|
10
|
-
def info(message = nil
|
|
26
|
+
def info(message = nil)
|
|
27
|
+
return unless log.level < 2
|
|
28
|
+
|
|
11
29
|
message = yield if message.nil? && block_given?
|
|
12
30
|
message = Rainbow(message).green if @color
|
|
13
31
|
log.info(message)
|
|
14
32
|
end
|
|
15
33
|
|
|
16
|
-
def warn(message = nil
|
|
34
|
+
def warn(message = nil)
|
|
35
|
+
return unless log.level < 3
|
|
36
|
+
|
|
17
37
|
message = yield if message.nil? && block_given?
|
|
18
38
|
message = Rainbow(message).yellow if @color
|
|
19
39
|
log.warn(message)
|
|
20
40
|
end
|
|
21
41
|
|
|
22
|
-
def error(message = nil
|
|
42
|
+
def error(message = nil)
|
|
43
|
+
return unless log.level < 4
|
|
44
|
+
|
|
23
45
|
message = yield if message.nil? && block_given?
|
|
24
46
|
message = Rainbow(message).red if @color
|
|
25
47
|
log.error(message)
|
|
26
48
|
end
|
|
27
49
|
|
|
28
|
-
def fatal(message = nil
|
|
50
|
+
def fatal(message = nil)
|
|
51
|
+
return unless log.level < 5
|
|
52
|
+
|
|
29
53
|
message = yield if message.nil? && block_given?
|
|
30
54
|
message = Rainbow(message).darkred if @color
|
|
31
55
|
log.fatal(message)
|
|
32
56
|
end
|
|
33
57
|
|
|
34
|
-
def unknown(message = nil
|
|
58
|
+
def unknown(message = nil)
|
|
35
59
|
message = yield if message.nil? && block_given?
|
|
36
60
|
message = Rainbow(message).purple if @color
|
|
37
61
|
log.unknown(message)
|
|
38
62
|
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, **_opts)
|
|
72
|
+
if kvl
|
|
73
|
+
"thread=#{Thread.current.object_id}"
|
|
74
|
+
else
|
|
75
|
+
Thread.current.object_id.to_s
|
|
76
|
+
end
|
|
77
|
+
end
|
|
39
78
|
end
|
|
40
79
|
end
|
|
41
80
|
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
sonar.projectKey=legion-io_legion-logging
|
|
2
|
+
sonar.organization=legion-io
|
|
3
|
+
sonar.projectName=Legion::Logging
|
|
4
|
+
sonar.sources=.
|
|
5
|
+
sonar.exclusions=vendor/**
|
|
6
|
+
sonar.coverage.exclusions=spec/**
|
|
7
|
+
sonar.ruby.coverage.reportPath=coverage/.resultset.json
|
|
8
|
+
sonar.ruby.file.suffixes=rb,ruby
|
|
9
|
+
sonar.ruby.coverage.framework=RSpec
|
|
10
|
+
sonar.ruby.rubocopConfig=.rubocop.yml
|
|
11
|
+
sonar.ruby.rubocop.reportPath=rubocop-result.json
|
|
12
|
+
sonar.ruby.rubocop.filePath=.
|
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:
|
|
4
|
+
version: 1.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Esity
|
|
8
|
-
autorequire:
|
|
9
|
-
bindir:
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-
|
|
11
|
+
date: 2020-10-22 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: '
|
|
47
|
+
version: '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: '
|
|
54
|
+
version: '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: '
|
|
61
|
+
version: '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: '
|
|
68
|
+
version: '0'
|
|
69
69
|
- !ruby/object:Gem::Dependency
|
|
70
70
|
name: rspec_junit_formatter
|
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -95,7 +95,7 @@ dependencies:
|
|
|
95
95
|
- !ruby/object:Gem::Version
|
|
96
96
|
version: '0'
|
|
97
97
|
- !ruby/object:Gem::Dependency
|
|
98
|
-
name:
|
|
98
|
+
name: rubocop-performance
|
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
|
100
100
|
requirements:
|
|
101
101
|
- - ">="
|
|
@@ -109,19 +109,19 @@ dependencies:
|
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
110
|
version: '0'
|
|
111
111
|
- !ruby/object:Gem::Dependency
|
|
112
|
-
name:
|
|
112
|
+
name: simplecov
|
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
|
114
114
|
requirements:
|
|
115
|
-
- - "
|
|
115
|
+
- - "<"
|
|
116
116
|
- !ruby/object:Gem::Version
|
|
117
|
-
version:
|
|
118
|
-
type: :
|
|
117
|
+
version: 0.18.0
|
|
118
|
+
type: :development
|
|
119
119
|
prerelease: false
|
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
|
121
121
|
requirements:
|
|
122
|
-
- - "
|
|
122
|
+
- - "<"
|
|
123
123
|
- !ruby/object:Gem::Version
|
|
124
|
-
version:
|
|
124
|
+
version: 0.18.0
|
|
125
125
|
- !ruby/object:Gem::Dependency
|
|
126
126
|
name: rainbow
|
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -145,15 +145,10 @@ extra_rdoc_files: []
|
|
|
145
145
|
files:
|
|
146
146
|
- ".circleci/config.yml"
|
|
147
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"
|
|
154
148
|
- ".rubocop.yml"
|
|
155
149
|
- CHANGELOG.md
|
|
156
150
|
- Gemfile
|
|
151
|
+
- Gemfile.lock
|
|
157
152
|
- README.md
|
|
158
153
|
- Rakefile
|
|
159
154
|
- bitbucket-pipelines.yml
|
|
@@ -163,6 +158,7 @@ files:
|
|
|
163
158
|
- lib/legion/logging/logger.rb
|
|
164
159
|
- lib/legion/logging/methods.rb
|
|
165
160
|
- lib/legion/logging/version.rb
|
|
161
|
+
- sonar-project.properties
|
|
166
162
|
homepage: https://bitbucket.org/legion-io/legion-logging
|
|
167
163
|
licenses: []
|
|
168
164
|
metadata:
|
|
@@ -172,7 +168,7 @@ metadata:
|
|
|
172
168
|
homepage_uri: https://bitbucket.org/legion-io/legion-logging
|
|
173
169
|
source_code_uri: https://bitbucket.org/legion-io/legion-logging
|
|
174
170
|
wiki_uri: https://bitbucket.org/legion-io/legion-logging/wiki/Home
|
|
175
|
-
post_install_message:
|
|
171
|
+
post_install_message:
|
|
176
172
|
rdoc_options: []
|
|
177
173
|
require_paths:
|
|
178
174
|
- lib
|
|
@@ -180,15 +176,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
180
176
|
requirements:
|
|
181
177
|
- - ">="
|
|
182
178
|
- !ruby/object:Gem::Version
|
|
183
|
-
version:
|
|
179
|
+
version: 2.5.0
|
|
184
180
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
181
|
requirements:
|
|
186
182
|
- - ">="
|
|
187
183
|
- !ruby/object:Gem::Version
|
|
188
184
|
version: '0'
|
|
189
185
|
requirements: []
|
|
190
|
-
rubygems_version: 3.
|
|
191
|
-
signing_key:
|
|
186
|
+
rubygems_version: 3.1.2
|
|
187
|
+
signing_key:
|
|
192
188
|
specification_version: 4
|
|
193
189
|
summary: The Legion::Logging class
|
|
194
190
|
test_files: []
|
data/.idea/.rakeTasks
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
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>
|
data/.idea/legion-logging.iml
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
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
DELETED
data/.idea/workspace.xml
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
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>
|