From b5dc82f30d7b28f5cf6777d32797cc01f4ff2f01 Mon Sep 17 00:00:00 2001 From: Tim Pease Date: Sat, 4 Jul 2020 15:31:26 -0600 Subject: [PATCH] simplify the file descriptor code smidge --- lib/logging/appenders/console.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/logging/appenders/console.rb b/lib/logging/appenders/console.rb index f4e5eb0..3f12a21 100644 --- a/lib/logging/appenders/console.rb +++ b/lib/logging/appenders/console.rb @@ -50,16 +50,17 @@ def reopen private def open_fd - case self.class.name.split("::").last.downcase - when "stdout" + case self.class.name + when "Logging::Appenders::Stdout" fd = STDOUT.fileno encoding = STDOUT.external_encoding - when "stderr" + when "Logging::Appenders::Stderr" fd = STDERR.fileno encoding = STDERR.external_encoding else raise RuntimeError, "Please do not use the `Logging::Appenders::Console` class directly - " + - "use `Logging::Appenders::Stdout` and `Logging::Appenders::Stderr` instead" + "use `Logging::Appenders::Stdout` and `Logging::Appenders::Stderr` instead" + + " [class #{self.class.name}]" end mode = ::File::WRONLY | ::File::APPEND