Skip to content

Commit

Permalink
simplify the file descriptor code smidge
Browse files Browse the repository at this point in the history
  • Loading branch information
TwP committed Jul 4, 2020
1 parent 69324bb commit b5dc82f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/logging/appenders/console.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b5dc82f

Please sign in to comment.