Skip to content

Commit

Permalink
Merge pull request #4492 from daipom/console-adapter-support-console-…
Browse files Browse the repository at this point in the history
…v1.25

log/console_adapter: support 'console' gem v1.25
  • Loading branch information
ashie authored May 17, 2024
2 parents 236d87d + daa6c76 commit b15cda4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/fluent/log/console_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@
# limitations under the License.
#

require 'console/terminal/logger'
require 'console'

module Fluent
class Log
# Async gem which is used by http_server helper switched logger mechanism to
# Console gem which isn't complatible with Ruby's standard Logger (since
# v1.17). This class adapts it to Fluentd's logger mechanism.
class ConsoleAdapter < Console::Terminal::Logger
class ConsoleAdapter < Gem::Version.new(Console::VERSION) >= Gem::Version.new("1.25") ?
Console::Output::Terminal : Console::Terminal::Logger

def self.wrap(logger)
_, level = Console::Logger::LEVELS.find { |key, value|
if logger.level <= 0
Expand Down

0 comments on commit b15cda4

Please sign in to comment.