railway-ipc 2.0.0 → 2.0.1

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: 11e49c11ff3e5815f7c8050ad5fcdfde1510cf7646d10cfa5d1104a5c1868422
4
- data.tar.gz: 3fbdeab2e555f9c4b3402cf27e3b072d33c833f85659eaccc09f31d11fddc219
3
+ metadata.gz: 11bbf2da076cd07dca74c10a4012cf6e737c7608db72cae9caee418e9188c105
4
+ data.tar.gz: b38f426df0aca6a34e18ea7de764d74eaccc183c10fe6af3a04681d7bb658af2
5
5
  SHA512:
6
- metadata.gz: 70d3834ac2a0db7b1a9a53c52edb3718b34a821d3b0d42e49ebe01f1c76c00188b928734a5969ef621e9609a3852117fd8190706566777c870b2b8b3d9592ccd
7
- data.tar.gz: 297bbf2e92f9a77d85661849f3bbada5b18eff08b213ec6a48089dea112ab65b70a47b196e8ddc59b475e61cb9e6ecfc8648bb5dcbcd2836e341079d81b2fd92
6
+ metadata.gz: 3ff4e1f023ad41059c6094f1e6546fac6a4fdc1f4037a4fe9d482327b7b66c23a6db051624ac22338800d52d2c636ec272d01dc853fed22f86d539d7b6fb2333
7
+ data.tar.gz: 72f11fcae1cff787ebd8f0a361ff67b81afb1003a8e265d59726a0ee701a35f22b53cd7bddabfb725b6dba217d8fab8da19932594ee9ae1583a508c27083a5d2
@@ -10,6 +10,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
10
10
  ### Removed
11
11
  ### Fixed
12
12
 
13
+ ## [2.0.1] - 2020-08-24
14
+ ### Fixed
15
+ * `RailwayIpc::Logger` now handles block syntax (i.e. `logger.info { 'my message' }`) correctly.
16
+
13
17
  ## [2.0.0] - 2020-08-20
14
18
  ### Added
15
19
  * Several additions to internal logging:
@@ -54,7 +58,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
54
58
  ### Added
55
59
  - Correlation ID and message UUID are auto generated for messages for IDs are not passed in [#23](https://github.com/learn-co/railway_ipc_gem/pull/23)
56
60
 
57
- [Unreleased]: https://github.com/learn-co/railway_ipc_gem/compare/v1.1.0...HEAD
61
+ [Unreleased]: https://github.com/learn-co/railway_ipc_gem/compare/v2.0.1...HEAD
62
+ [2.0.1]: https://github.com/learn-co/railway_ipc_gem/compare/v2.0.0...v2.0.1
63
+ [2.0.0]: https://github.com/learn-co/railway_ipc_gem/compare/v1.1.0...v2.0.0
58
64
  [1.1.0]: https://github.com/learn-co/railway_ipc_gem/compare/v1.0.1...v1.1.0
59
65
  [1.0.1]: https://github.com/learn-co/railway_ipc_gem/compare/v1.0.0...v1.0.1
60
66
  [1.0.0]: https://github.com/learn-co/railway_ipc_gem/compare/v0.1.7...v1.0.0
@@ -28,9 +28,21 @@ module RailwayIpc
28
28
  end
29
29
 
30
30
  %w[fatal error warn info debug].each do |level|
31
- define_method(level) do |message, data={}|
31
+ define_method(level) do |message=nil, data={}, &block|
32
32
  data.merge!(feature: 'railway_ipc') unless data.key?(:feature)
33
- logger.send(level, data.merge(message: message))
33
+ return logger.send(level, data.merge(message: message)) unless block
34
+
35
+ data = message.merge(data) if message&.is_a?(Hash)
36
+ data.merge!(message: block.call)
37
+
38
+ # This is for compatability w/ Ruby's Logger. Ruby's Logger class
39
+ # assumes that if both a `message` argument and a block are given,
40
+ # that the block contains the actual message. The `message` argument
41
+ # is assumed to be the `progname`.
42
+ #
43
+ # https://github.com/ruby/logger/blob/master/lib/logger.rb#L471
44
+ data.merge!(progname: message) if message&.is_a?(String)
45
+ logger.send(level, data)
34
46
  end
35
47
  end
36
48
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailwayIpc
4
- VERSION = '2.0.0'
4
+ VERSION = '2.0.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railway-ipc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-08-20 00:00:00.000000000 Z
11
+ date: 2020-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler