From 7a1939d72a4938067497c9deb6ab34c26fcfe69d Mon Sep 17 00:00:00 2001 From: Brody Hoskins Date: Wed, 29 Oct 2025 12:32:26 -0700 Subject: [PATCH] Use `Gem::Specification.find_all_by_name` on Ruby 3.4+ to avoid deprecation warning --- lib/logging.rb | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/logging.rb b/lib/logging.rb index eb4668ad..2f90331a 100644 --- a/lib/logging.rb +++ b/lib/logging.rb @@ -7,9 +7,19 @@ require 'multi_json' begin - require 'syslog' - HAVE_SYSLOG = true -rescue LoadError + if RUBY_VERSION >= '3.4' + if Gem::Specification.find_all_by_name('syslog').any? + gem 'syslog' + require 'syslog' + HAVE_SYSLOG = true + else + HAVE_SYSLOG = false + end + else + require 'syslog' + HAVE_SYSLOG = true + end +rescue Gem::LoadError, LoadError HAVE_SYSLOG = false end