diff --git a/lib/logging.rb b/lib/logging.rb index eb4668a..2f90331 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