logcraft 2.2 → 2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f83b1cb57e7d3a8072d8fc2d7b5b7d952cd9f96eb72edecb88244179384d4f61
4
- data.tar.gz: 2f679955495954defc5ba217f0ef36318f0fae6e8d050c48b834c582b8742ff8
3
+ metadata.gz: cf02f8ae6ffa5dead32fea6f287d8e85c39acfb14fe2678223312cbb7c3ffd0c
4
+ data.tar.gz: 8b22305887593aa695eec3f47fb0b9d88d2097bbfd2a2e1a42e14caa345a7e79
5
5
  SHA512:
6
- metadata.gz: ad933459ec43e29bcf9c13627d591ded635601e1a2df160c7178c98abadb5f103bacdd3b160d5ab7900b83fa0b254d701be6eaeb7e1277dfc211a76303f4b376
7
- data.tar.gz: a1693794447ab3fc3180c9aa905d397fd4ae7f4e23fe7474d7c7817cfef8acecf41935db8f4a1589ee691133af7186d486d60a7df432ff02230a089483010fcf
6
+ metadata.gz: d6a6fa0a3686bbc4f73f76eac8a91537c1ac22aa2f10ab72611a70f1f52ec3876af08ac0c80536276141529685620b67e25b5eee057513daaabf95495fc27645
7
+ data.tar.gz: 6ea6f6a1f737d225ad4153506071b6f1cdfcafb722c423ea37695861c5880c3313a779c3f084bb49a409d99b3a599034a586554ce82917a5302487a8d0d35eba
data/CHANGELOG.md CHANGED
@@ -4,6 +4,22 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [2.3] - 2026-07-28
8
+ ### Changed
9
+ - Replaced `OpenStruct` with a plain `Struct` for the internal STDOUT log device, removing the reliance on
10
+ `ostruct` — which is no longer a default gem in current Ruby versions. The Struct is now created once and
11
+ shared instead of per logger.
12
+ (https://github.com/zormandi/logcraft/pull/13, https://github.com/zormandi/logcraft/pull/14)
13
+
14
+ Thanks to [@jbigler](https://github.com/jbigler) for both contributions.
15
+
16
+ ## [2.2.1] - 2023-12-19
17
+ ### Fixed
18
+ - Fixed an issue where logs were duplicated (once in JSON, once in plain text) when running the Rails console.
19
+ (https://github.com/zormandi/logcraft/issues/7)
20
+ - Fixed an issue that prevented using Logcraft and Sentry-Rails together with the default configuration.
21
+ (https://github.com/zormandi/logcraft/issues/6)
22
+
7
23
  ## [2.2] - 2023-10-23
8
24
  ### Added
9
25
  - Added support for Rails 7.1.
data/README.md CHANGED
@@ -18,7 +18,6 @@ Logcraft supports:
18
18
 
19
19
  * [Ruby](https://www.ruby-lang.org) 2.6 and up (tested with 2.6, 2.7, 3.0 and 3.1)
20
20
  * [Rails](https://rubyonrails.org/) 5 and up (tested with 5.2, 6.0, 6.1, 7.0 and 7.1)
21
- * [Rails](https://rubyonrails.org/) 5 and up (tested with 5.2, 6.0, 6.1 and 7.0)
22
21
  * [Sidekiq](https://github.com/mperham/sidekiq) integration is provided via
23
22
  the [Logcraft::Sidekiq](https://github.com/zormandi/logcraft-sidekiq) gem
24
23
 
@@ -9,4 +9,6 @@ group :test do
9
9
  gem 'rails', '~> 5.2.0'
10
10
  gem 'rspec-rails', '~> 4.0'
11
11
  gem 'sqlite3', '~> 1.4'
12
+ # concurrent-ruby >= 1.3.5 dropped its internal "logger" require, which breaks Active Support < 7.1.
13
+ gem 'concurrent-ruby', '< 1.3.5'
12
14
  end
@@ -9,4 +9,6 @@ group :test do
9
9
  gem 'rails', '~> 6.0.0'
10
10
  gem 'rspec-rails', '~> 4.0'
11
11
  gem 'sqlite3', '~> 1.4'
12
+ # concurrent-ruby >= 1.3.5 dropped its internal "logger" require, which breaks Active Support < 7.1.
13
+ gem 'concurrent-ruby', '< 1.3.5'
12
14
  end
@@ -9,5 +9,7 @@ group :test do
9
9
  gem 'rails', '~> 6.1.0'
10
10
  gem 'rspec-rails', '~> 4.0'
11
11
  gem 'sqlite3', '~> 1.4'
12
+ # concurrent-ruby >= 1.3.5 dropped its internal "logger" require, which breaks Active Support < 7.1.
13
+ gem 'concurrent-ruby', '< 1.3.5'
12
14
  gem 'net-smtp', require: false
13
15
  end
@@ -9,5 +9,7 @@ group :test do
9
9
  gem 'rails', '~> 7.0.0'
10
10
  gem 'rspec-rails', '~> 4.0'
11
11
  gem 'sqlite3', '~> 1.4'
12
+ # concurrent-ruby >= 1.3.5 dropped its internal "logger" require, which breaks Active Support < 7.1.
13
+ gem 'concurrent-ruby', '< 1.3.5'
12
14
  gem 'net-smtp', require: false
13
15
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Logcraft
4
- VERSION = "2.2"
4
+ VERSION = "2.3"
5
5
  end
data/lib/logcraft.rb CHANGED
@@ -12,12 +12,22 @@ module Logcraft
12
12
 
13
13
  extend LogContextHelper
14
14
 
15
+ STDOUT_LOG_DEVICE = Struct.new(:dev).new(STDOUT).freeze
16
+
15
17
  def self.initialize(log_level: :info, global_context: {}, layout_options: {})
16
18
  Logging.logger.root.appenders = Logging.appenders.stdout layout: LogLayout.new(global_context, layout_options)
17
19
  Logging.logger.root.level = log_level
18
20
  end
19
21
 
20
22
  def self.logger(name, level = nil)
21
- Logging::Logger[name].tap { |logger| logger.level = level if level }
23
+ Logging::Logger[name].tap do |logger|
24
+ logger.level = level if level
25
+ logger.instance_variable_set :@logdev, STDOUT_LOG_DEVICE
26
+ logger.define_singleton_method :dup do
27
+ super().tap do |logger_copy|
28
+ Logging::Logger.define_log_methods logger_copy
29
+ end
30
+ end
31
+ end
22
32
  end
23
33
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logcraft
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.2'
4
+ version: '2.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zoltan Ormandi
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2023-10-23 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: logging
@@ -80,7 +79,6 @@ dependencies:
80
79
  - - "~>"
81
80
  - !ruby/object:Gem::Version
82
81
  version: '3.0'
83
- description:
84
82
  email:
85
83
  - zoltan.ormandi@gmail.com
86
84
  executables: []
@@ -121,7 +119,6 @@ metadata:
121
119
  homepage_uri: https://github.com/zormandi/logcraft
122
120
  source_code_uri: https://github.com/zormandi/logcraft
123
121
  changelog_uri: https://github.com/zormandi/logcraft/blob/main/CHANGELOG.md
124
- post_install_message:
125
122
  rdoc_options: []
126
123
  require_paths:
127
124
  - lib
@@ -136,8 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
133
  - !ruby/object:Gem::Version
137
134
  version: '0'
138
135
  requirements: []
139
- rubygems_version: 3.4.10
140
- signing_key:
136
+ rubygems_version: 4.0.17
141
137
  specification_version: 4
142
138
  summary: A zero-configuration structured logging solution for pure Ruby or Ruby on
143
139
  Rails projects.