legion-logging 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 979499ffe521486bed7120fbd78e9bec1754440a536c40fa96eed1b34b744ef7
4
- data.tar.gz: 49f500fa85f6e5740815126bbc432eea5975ce6612553c0523d7d4622ed63f13
3
+ metadata.gz: e9ecd67d5e6c68af98e3b53869a576f4d9cfb4021498f66903bfd57b5ff533e1
4
+ data.tar.gz: 896e360f937631af59ea1cf4cba88be1baa8b6d23a432506c3c016db6c263f1f
5
5
  SHA512:
6
- metadata.gz: ef65f65c39df3a23dfb4e24745255ad4c88f18f4d350da527f876aeca155039905fb9dd71ff0578b7aeb5108d44d0b442d757c50870a3978a125607957e579fc
7
- data.tar.gz: 52397bf857f760967064e6d4cd7d9f60598cc38f8466185ac3dd6fcf810dd60b6eeedf57b841ebc4c0af57df9121ca537228cb07467378462a3a4dda7ca1f196
6
+ metadata.gz: d8d7e995ca4a2ed5f54636ebbe9fdea124f47caea4e0c43c5e65dcfc5f6716d770394cc94d033fbfacdb6d2cb3cc8d80319637485a62388362eb8468842c482f
7
+ data.tar.gz: 15f2613124940fbeee5868992c6ef7f53f3b10950d2bb835145309c4a82a8a67a92f3de1e23fdbb71a91e68c4f6ba67eab43ee98d549d4f9e1d3d3c214c5a8a3
@@ -1,11 +1,12 @@
1
1
  version: 2.1
2
2
  orbs:
3
3
  ruby: circleci/ruby@0.2.1
4
+ sonarcloud: sonarsource/sonarcloud@1.0.1
4
5
 
5
6
  jobs:
6
7
  "rubocop":
7
8
  docker:
8
- - image: circleci/ruby:2.5-node
9
+ - image: circleci/ruby:2.7-node
9
10
  steps:
10
11
  - checkout
11
12
  - ruby/load-cache
@@ -17,20 +18,24 @@ jobs:
17
18
  "ruby-two-five":
18
19
  docker:
19
20
  - image: circleci/ruby:2.5
20
- - image: memcached:1.5-alpine
21
21
  steps:
22
22
  - checkout
23
23
  - ruby/load-cache
24
+ - run:
25
+ name: update bundler
26
+ command: gem update bundler
24
27
  - ruby/install-deps
25
28
  - ruby/run-tests
26
29
  - ruby/save-cache
27
30
  "ruby-two-six":
28
31
  docker:
29
32
  - image: circleci/ruby:2.6
30
- - image: memcached:1.5-alpine
31
33
  steps:
32
34
  - checkout
33
35
  - ruby/load-cache
36
+ - run:
37
+ name: update bundler
38
+ command: gem update bundler
34
39
  - ruby/install-deps
35
40
  - ruby/run-tests
36
41
  - ruby/save-cache
@@ -44,6 +49,19 @@ jobs:
44
49
  - ruby/install-deps
45
50
  - ruby/run-tests
46
51
  - ruby/save-cache
52
+ "sonarcloud":
53
+ docker:
54
+ - image: circleci/ruby:2.7
55
+ steps:
56
+ - checkout
57
+ - ruby/load-cache
58
+ - ruby/install-deps
59
+ - ruby/run-tests
60
+ - run:
61
+ name: Run Rubocop
62
+ command: bundle exec rubocop --format=json --out=rubocop-result.json
63
+ - sonarcloud/scan
64
+ - ruby/save-cache
47
65
 
48
66
  workflows:
49
67
  version: 2
@@ -58,4 +76,8 @@ workflows:
58
76
  - ruby-two-five
59
77
  - ruby-two-seven:
60
78
  requires:
61
- - ruby-two-five
79
+ - ruby-two-five
80
+ - sonarcloud:
81
+ requires:
82
+ - ruby-two-seven
83
+ - ruby-two-six
@@ -5,31 +5,34 @@
5
5
  </component>
6
6
  <component name="NewModuleRootManager">
7
7
  <content url="file://$MODULE_DIR$" />
8
- <orderEntry type="inheritedJdk" />
8
+ <orderEntry type="jdk" jdkName="RVM: ruby-2.7.0" jdkType="RUBY_SDK" />
9
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="parallel (v1.19.1, RVM: ruby-2.6.3) [gem]" level="application" />
18
- <orderEntry type="library" scope="PROVIDED" name="parser (v2.7.0.4, RVM: ruby-2.6.3) [gem]" level="application" />
19
- <orderEntry type="library" scope="PROVIDED" name="rainbow (v3.0.0, RVM: ruby-2.6.3) [gem]" level="application" />
20
- <orderEntry type="library" scope="PROVIDED" name="rake (v13.0.1, RVM: ruby-2.6.3) [gem]" level="application" />
21
- <orderEntry type="library" scope="PROVIDED" name="rexml (v3.2.4, RVM: ruby-2.6.3) [gem]" level="application" />
22
- <orderEntry type="library" scope="PROVIDED" name="rspec (v3.9.0, RVM: ruby-2.6.3) [gem]" level="application" />
23
- <orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.9.1, RVM: ruby-2.6.3) [gem]" level="application" />
24
- <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.9.0, RVM: ruby-2.6.3) [gem]" level="application" />
25
- <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.9.1, RVM: ruby-2.6.3) [gem]" level="application" />
26
- <orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.9.2, RVM: ruby-2.6.3) [gem]" level="application" />
27
- <orderEntry type="library" scope="PROVIDED" name="rspec_junit_formatter (v0.4.1, RVM: ruby-2.6.3) [gem]" level="application" />
28
- <orderEntry type="library" scope="PROVIDED" name="rubocop (v0.80.1, RVM: ruby-2.6.3) [gem]" level="application" />
29
- <orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.10.1, RVM: ruby-2.6.3) [gem]" level="application" />
30
- <orderEntry type="library" scope="PROVIDED" name="simplecov (v0.18.5, RVM: ruby-2.6.3) [gem]" level="application" />
31
- <orderEntry type="library" scope="PROVIDED" name="simplecov-html (v0.12.2, RVM: ruby-2.6.3) [gem]" level="application" />
32
- <orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v1.6.1, RVM: ruby-2.6.3) [gem]" level="application" />
33
- <orderEntry type="library" scope="PROVIDED" name="url (v0.3.2, RVM: ruby-2.6.3) [gem]" level="application" />
10
+ <orderEntry type="library" scope="PROVIDED" name="ast (v2.4.1, RVM: ruby-2.7.0) [gem]" level="application" />
11
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v2.1.4, RVM: ruby-2.7.0) [gem]" level="application" />
12
+ <orderEntry type="library" scope="PROVIDED" name="chef (v16.1.0, RVM: ruby-2.7.0) [gem]" level="application" />
13
+ <orderEntry type="library" scope="PROVIDED" name="codecov (v0.2.2, RVM: ruby-2.7.0) [gem]" level="application" />
14
+ <orderEntry type="library" scope="PROVIDED" name="colorize (v0.8.1, RVM: ruby-2.7.0) [gem]" level="application" />
15
+ <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.4.4, RVM: ruby-2.7.0) [gem]" level="application" />
16
+ <orderEntry type="library" scope="PROVIDED" name="docile (v1.3.2, RVM: ruby-2.7.0) [gem]" level="application" />
17
+ <orderEntry type="library" scope="PROVIDED" name="json (v2.3.1, RVM: ruby-2.7.0) [gem]" level="application" />
18
+ <orderEntry type="library" scope="PROVIDED" name="parallel (v1.19.2, RVM: ruby-2.7.0) [gem]" level="application" />
19
+ <orderEntry type="library" scope="PROVIDED" name="parser (v2.7.1.4, RVM: ruby-2.7.0) [gem]" level="application" />
20
+ <orderEntry type="library" scope="PROVIDED" name="rainbow (v3.0.0, RVM: ruby-2.7.0) [gem]" level="application" />
21
+ <orderEntry type="library" scope="PROVIDED" name="rake (v13.0.1, RVM: ruby-2.7.0) [gem]" level="application" />
22
+ <orderEntry type="library" scope="PROVIDED" name="regexp_parser (v1.7.1, RVM: ruby-2.7.0) [gem]" level="application" />
23
+ <orderEntry type="library" scope="PROVIDED" name="rexml (v3.2.4, RVM: ruby-2.7.0) [gem]" level="application" />
24
+ <orderEntry type="library" scope="PROVIDED" name="rspec (v3.9.0, RVM: ruby-2.7.0) [gem]" level="application" />
25
+ <orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.9.2, RVM: ruby-2.7.0) [gem]" level="application" />
26
+ <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.9.2, RVM: ruby-2.7.0) [gem]" level="application" />
27
+ <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.9.1, RVM: ruby-2.7.0) [gem]" level="application" />
28
+ <orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.9.3, RVM: ruby-2.7.0) [gem]" level="application" />
29
+ <orderEntry type="library" scope="PROVIDED" name="rspec_junit_formatter (v0.4.1, RVM: ruby-2.7.0) [gem]" level="application" />
30
+ <orderEntry type="library" scope="PROVIDED" name="rubocop (v0.88.0, RVM: ruby-2.7.0) [gem]" level="application" />
31
+ <orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v0.2.0, RVM: ruby-2.7.0) [gem]" level="application" />
32
+ <orderEntry type="library" scope="PROVIDED" name="rubocop-performance (v1.7.1, RVM: ruby-2.7.0) [gem]" level="application" />
33
+ <orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.10.1, RVM: ruby-2.7.0) [gem]" level="application" />
34
+ <orderEntry type="library" scope="PROVIDED" name="simplecov (v0.17.1, RVM: ruby-2.7.0) [gem]" level="application" />
35
+ <orderEntry type="library" scope="PROVIDED" name="simplecov-html (v0.10.2, RVM: ruby-2.7.0) [gem]" level="application" />
36
+ <orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v1.7.0, RVM: ruby-2.7.0) [gem]" level="application" />
34
37
  </component>
35
38
  </module>
@@ -1,4 +1,4 @@
1
- Metrics/LineLength:
1
+ Layout/LineLength:
2
2
  Max: 120
3
3
  Metrics/MethodLength:
4
4
  Max: 30
@@ -17,5 +17,6 @@ Style/Documentation:
17
17
  Enabled: false
18
18
  AllCops:
19
19
  TargetRubyVersion: 2.5
20
+ NewCops: enable
20
21
  Style/FrozenStringLiteralComment:
21
22
  Enabled: false
@@ -1,15 +1,18 @@
1
- image: ruby:2.5.0
1
+ image: ruby:2.7.0
2
2
 
3
3
  pipelines:
4
- default:
5
- - step:
6
- caches:
7
- - bundler
8
- script:
9
- - gem install bundle rubocop
10
- - bundle install
11
- - rubocop
12
- - rake
13
- definitions:
14
- caches:
15
- bundler: vendor/bundle
4
+ branches:
5
+ master:
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/**
@@ -31,7 +31,8 @@ Gem::Specification.new do |spec|
31
31
  spec.add_development_dependency 'rspec'
32
32
  spec.add_development_dependency 'rspec_junit_formatter'
33
33
  spec.add_development_dependency 'rubocop'
34
- spec.add_development_dependency 'simplecov'
34
+ spec.add_development_dependency 'rubocop-performance'
35
+ spec.add_development_dependency 'simplecov', '< 0.18.0'
35
36
 
36
37
  spec.add_dependency 'rainbow', '~> 3'
37
38
  end
@@ -1,7 +1,7 @@
1
1
  module Legion
2
2
  module Logging
3
3
  module Builder
4
- def log_format(options = {}, log = @log) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity
4
+ def log_format(options = {}, log = @log) # 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
7
  unless options[:lex_name].nil?
@@ -28,18 +28,19 @@ module Legion
28
28
  @log = ::Logger.new(options[:log_file]) unless options[:log_file].nil?
29
29
  end
30
30
 
31
- def log_level(level = 'debug', log = @log) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
32
- if level == 'trace'
31
+ def log_level(level = 'info', log = @log)
32
+ case level
33
+ when 'trace'
33
34
  log.level = ::Logger::INFO
34
- elsif level == 'debug'
35
+ when 'debug'
35
36
  log.level = ::Logger::DEBUG
36
- elsif level == 'info'
37
+ when 'info'
37
38
  log.level = ::Logger::INFO
38
- elsif level == 'warn'
39
+ when 'warn'
39
40
  log.level = ::Logger::WARN
40
- elsif level == 'error'
41
+ when 'error'
41
42
  log.level = ::Logger::ERROR
42
- elsif level == 'fatal'
43
+ when 'fatal'
43
44
  log.level = ::Logger::FATAL
44
45
  end
45
46
  @log = log
@@ -5,6 +5,7 @@ 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
 
@@ -1,7 +1,7 @@
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
4
+ def trace(raw_message = nil, log = @log, size: @trace_size, log_caller: true) # rubocop:disable Metrics/PerceivedComplexity, Metrics/AbcSize
5
5
  return unless @trace_enabled
6
6
 
7
7
  raw_message = yield if raw_message.nil? && block_given?
@@ -68,7 +68,7 @@ module Legion
68
68
  { success: false, message: exc.message, backtrace: exc.backtrace }.merge(opts)
69
69
  end
70
70
 
71
- def thread(kvl: false)
71
+ def thread(kvl: false, **_opts)
72
72
  if kvl
73
73
  "thread=#{Thread.current.object_id}"
74
74
  else
@@ -1,5 +1,5 @@
1
1
  module Legion
2
2
  module Logging
3
- VERSION = '1.0.0'.freeze
3
+ VERSION = '1.1.0'.freeze
4
4
  end
5
5
  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: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-12 00:00:00.000000000 Z
11
+ date: 2020-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -95,7 +95,7 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: simplecov
98
+ name: rubocop-performance
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: simplecov
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "<"
116
+ - !ruby/object:Gem::Version
117
+ version: 0.18.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "<"
123
+ - !ruby/object:Gem::Version
124
+ version: 0.18.0
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: rainbow
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -140,6 +154,7 @@ files:
140
154
  - ".rubocop.yml"
141
155
  - CHANGELOG.md
142
156
  - Gemfile
157
+ - Gemfile.lock
143
158
  - README.md
144
159
  - Rakefile
145
160
  - bitbucket-pipelines.yml
@@ -149,6 +164,7 @@ files:
149
164
  - lib/legion/logging/logger.rb
150
165
  - lib/legion/logging/methods.rb
151
166
  - lib/legion/logging/version.rb
167
+ - sonar-project.properties
152
168
  homepage: https://bitbucket.org/legion-io/legion-logging
153
169
  licenses: []
154
170
  metadata:
@@ -158,7 +174,7 @@ metadata:
158
174
  homepage_uri: https://bitbucket.org/legion-io/legion-logging
159
175
  source_code_uri: https://bitbucket.org/legion-io/legion-logging
160
176
  wiki_uri: https://bitbucket.org/legion-io/legion-logging/wiki/Home
161
- post_install_message:
177
+ post_install_message:
162
178
  rdoc_options: []
163
179
  require_paths:
164
180
  - lib
@@ -173,8 +189,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
189
  - !ruby/object:Gem::Version
174
190
  version: '0'
175
191
  requirements: []
176
- rubygems_version: 3.0.8
177
- signing_key:
192
+ rubygems_version: 3.1.2
193
+ signing_key:
178
194
  specification_version: 4
179
195
  summary: The Legion::Logging class
180
196
  test_files: []