ezlog 0.3.1 → 0.3.2

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
- SHA256:
3
- metadata.gz: 93492a6b3f140b41d4aad461fcb7bd9017149c3bca1a0d19a9edf5e2ed9fc25d
4
- data.tar.gz: bddac2fcd0e1ef426f228e97bb537a34704d102d8f480cee872be74e505aefcc
2
+ SHA1:
3
+ metadata.gz: 224d8e39821229350d6b406645432d210cc2b2e8
4
+ data.tar.gz: 45d821f0923048e29c085a3a86a6104776b2dbc0
5
5
  SHA512:
6
- metadata.gz: 22f5427eaa445d7189140bb98bf1206f2e5b0dd0b1df8d1f1ec12af01a2472dea1006422b69e50d28bf7c87dd9f2002ee29ba7a8dcdbccceea6cb3c65ff60080
7
- data.tar.gz: 8c0c3f28b548609c667f7e4b1d610a50a9a44a114b05a66dfaef9901d6f252e564eb6458ae4808c5154c759e685dd44b368b984a076ad1b9b7a53a75a555ae89
6
+ metadata.gz: 8ad716714f7e5cef573a434828bca5984ed5af24222a339f1e9712a9e4ccb3478f326c01219fac4f01e34afad0b25b052c550309626d4c04a861be673b2bb46b
7
+ data.tar.gz: febe42af5f6d3356e644cce5c43c289bcba87cc8a1caa2ace751f9fd7d23cbc66be7ea59c5251c44cdd55436f4136fab9985ece9e41552d77b05b48a95e8dd8e
@@ -3,5 +3,7 @@ sudo: false
3
3
  language: ruby
4
4
  cache: bundler
5
5
  rvm:
6
- - 2.5.0
6
+ - 2.4.6
7
+ - 2.5.5
8
+ - 2.6.3
7
9
  before_install: gem install bundler -v 2.0.1
@@ -1,12 +1,23 @@
1
+ ### 0.3.2 (2019-06-18)
2
+
3
+ [Full Changelog](https://github.com/emartech/ezlog/compare/v0.3.1...v0.3.2)
4
+
5
+ * Features & enhancements
6
+ * Ruby 2.4 is supported
7
+
8
+ * Bug fixes
9
+ * Default log level is now set for the root logger instead of the root log layout so that the log level can be
10
+ overriden programatically per logger (if necessary)
11
+
1
12
  ### 0.3.1 (2019-06-09)
2
13
 
3
14
  [Full Changelog](https://github.com/emartech/ezlog/compare/v0.2.2...v0.3.1)
4
15
 
5
16
  * Features & enhancements
6
- * Unified access log for Rails
17
+ * Unified access log for [Rails](https://rubyonrails.org/)
7
18
  * 1 message per request
8
19
  * Includes request ID, parameters, response code
9
- * Non-verbose logging of uncaught exceptions in Rails apps
20
+ * Non-verbose logging of uncaught exceptions in [Rails](https://rubyonrails.org/) apps
10
21
  * 1 message per error
11
22
  * Use ERROR level instead of FATAL
12
23
  * [Rack::Timeout](https://github.com/heroku/rack-timeout) logging is now completely turned off, because Timeout errors
@@ -44,4 +55,4 @@ First version of the gem including the following:
44
55
  * JobLogger for [Sidekiq](https://github.com/mperham/sidekiq)
45
56
  * Filter [Rack::Timeout](https://github.com/heroku/rack-timeout) logs to WARN level and above
46
57
  * [RSpec](https://rspec.info/) support
47
- * Rails integration via Railtie
58
+ * [Rails](https://rubyonrails.org/) integration via Railtie
data/README.md CHANGED
@@ -34,9 +34,9 @@ That's it. Everything else is automatically configured.
34
34
  ## What it does
35
35
 
36
36
  * Initializes the [Logging](https://github.com/TwP/logging) library
37
- * Configures Rails logging
38
- * Configures Sidekiq logging
39
- * Configures Rack::Timeout logging
37
+ * Configures [Rails](https://rubyonrails.org/)'s logging
38
+ * Configures [Sidekiq](https://github.com/mperham/sidekiq) logging
39
+ * Configures [Rack::Timeout](https://github.com/heroku/rack-timeout) logging
40
40
  * Provides testing support for [RSpec](https://rspec.info/)
41
41
 
42
42
  #### Initializes the Logging library
@@ -67,23 +67,23 @@ logger.info message: 'Job finished', duration: 2
67
67
  #=> {"logger":"App","timestamp":"2019-05-11T16:08:38+02:00","level":"INFO","hostname":"MacbookPro.local","pid":71674,"message":"Job finished","duration":2}
68
68
 
69
69
  logger.error ex
70
- #=> {"logger":"App","timestamp":"2019-05-11T16:08:38+02:00","level":"INFO","hostname":"MacbookPro.local","pid":71674,"message":"Error message","error":{"class":"StandardError","message":"Error message","backtrace":[...]}}
70
+ #=> {"logger":"App","timestamp":"2019-05-11T16:08:38+02:00","level":"ERROR","hostname":"MacbookPro.local","pid":71674,"message":"Error message","error":{"class":"StandardError","message":"Error message","backtrace":[...]}}
71
71
  ```
72
72
 
73
73
  #### Configures Rails logging
74
74
 
75
75
  Ezlog configures the `Rails.logger` to be an instance of a [Logging](https://github.com/TwP/logging) logger by the name
76
- of `Application`, behaving as described above. The logger uses the log level set in `application.rb` (if present) or
77
- uses INFO as a default log level.
76
+ of `Application`, behaving as described above. The logger uses the log level set in `application.rb` if present, or
77
+ INFO as a default log level.
78
78
 
79
79
  In addition to this, Ezlog also does the following:
80
80
  * It adds the environment (`Rails.env`) to the logger's initial context, so it will automatically be appended to all log messages
81
81
  emitted by the application.
82
- * It disables Rails's default (verbose) logging of uncaught errors and injects its own error logger into the application, which
82
+ * It disables Rails's default logging of uncaught errors and injects its own error logger into the application, which
83
83
  * logs 1 line per error, including the error's name and context (stack trace, etc.),
84
84
  * logs every error at ERROR level instead of the default FATAL.
85
- * It disables Rails's default (verbose) request logging, which logs several lines per event during the processing of an action
86
- and replaces the default Rack access log with its own access log middleware. The end result is an access log, which
85
+ * It disables Rails's default request logging, which logs several lines per event during the processing of an action,
86
+ and replaces the default Rack access log with its own access log middleware. The end result is an access log that
87
87
  * contains all relevant information (request ID, method, path, params, client IP, duration and response status code), and
88
88
  * has 1 log line per request, logged at the end of the request.
89
89
 
@@ -123,6 +123,8 @@ during the execution of the job will contain this information as well.
123
123
 
124
124
  ```ruby
125
125
  class TestWorker
126
+ include Sidekiq::Worker
127
+
126
128
  def perform(customer_id)
127
129
  logger.warn 'Customer not found'
128
130
  end
@@ -145,6 +147,7 @@ as well. For this reason, Ezlog turns off [Rack::Timeout](https://github.com/her
145
147
 
146
148
  Ezlog comes with built-in support for testing your logging activity using [RSpec](https://rspec.info/).
147
149
  To enable spec support for Ezlog, put this line in your `spec_helper.rb` or `rails_helper.rb`:
150
+
148
151
  ```ruby
149
152
  require "ezlog/rspec"
150
153
  ```
@@ -1,9 +1,8 @@
1
1
  module Ezlog
2
2
  class Railtie < Rails::Railtie
3
3
  initializer 'ezlog.configure_logging' do |app|
4
- ::Logging.logger.root.appenders = ::Logging.appenders.stdout 'stdout',
5
- layout: Ezlog::LoggingLayout.new(environment: ::Rails.env),
6
- level: app.config.log_level
4
+ ::Logging.logger.root.appenders = ::Logging.appenders.stdout 'stdout', layout: Ezlog::LoggingLayout.new(environment: ::Rails.env)
5
+ ::Logging.logger.root.level = app.config.log_level
7
6
  end
8
7
 
9
8
  initializer 'ezlog.configure_sidekiq_logging' do
@@ -34,7 +33,7 @@ module Ezlog
34
33
  private
35
34
 
36
35
  def initialize_sidekiq_logging
37
- ::Sidekiq.logger = ::Logging.logger['Sidekiq']
36
+ ::Sidekiq.logger = Ezlog.logger('Sidekiq')
38
37
  ::Sidekiq.logger.level = :info
39
38
  ::Sidekiq.configure_server do |config|
40
39
  config.options[:job_logger] = Ezlog::Sidekiq::JobLogger
@@ -7,12 +7,14 @@ module Ezlog
7
7
 
8
8
  def call(job_hash, _queue)
9
9
  within_log_context(JobContext.from_job_hash(job_hash)) do
10
- logger.info "#{job_hash['class']} started"
11
- benchmark { yield }
12
- logger.info message: "#{job_hash['class']} finished"
13
- rescue Exception
14
- logger.info message: "#{job_hash['class']} failed"
15
- raise
10
+ begin
11
+ logger.info "#{job_hash['class']} started"
12
+ benchmark { yield }
13
+ logger.info message: "#{job_hash['class']} finished"
14
+ rescue Exception
15
+ logger.info message: "#{job_hash['class']} failed"
16
+ raise
17
+ end
16
18
  end
17
19
  end
18
20
 
@@ -1,3 +1,3 @@
1
1
  module Ezlog
2
- VERSION = '0.3.1'
2
+ VERSION = '0.3.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ezlog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zoltan Ormandi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-09 00:00:00.000000000 Z
11
+ date: 2019-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logging
@@ -150,7 +150,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
150
  - !ruby/object:Gem::Version
151
151
  version: '0'
152
152
  requirements: []
153
- rubygems_version: 3.0.1
153
+ rubyforge_project:
154
+ rubygems_version: 2.6.13
154
155
  signing_key:
155
156
  specification_version: 4
156
157
  summary: A zero-configuration logging solution for projects using Sidekiq, Rails,