tty-logger icon indicating copy to clipboard operation
tty-logger copied to clipboard

Fix to show the name of log type correctly in Ruby 3.4

Open takahashim opened this issue 10 months ago • 1 comments

Describe the change

This PR fixes an issue in Ruby 3.4 where TTY::Logger fails to display the correct log type name.

Why are we doing this?

Suppose we run the following code:

require 'tty-logger'

logger = TTY::Logger.new
logger.success "Deployed successfully"

in Ruby 3.3.5:

✔ success Deployed successfully    

in Ruby 3.4.1:

ℹ info    Deployed successfully    

This is likely due to changes in the behavior of Thread::Backtrace::Location returned by caller_locations. https://github.com/ruby/ruby/blob/master/doc/NEWS/NEWS-3.4.0.md#compatibility-issues

Benefits

We can use TTY::Logger in Ruby 3.4.

Drawbacks

I hope nothing.

Requirements

  • [x] Tests written & passing locally?
  • [x] Code style checked?
  • [x] Rebased with master branch?
  • [x] Documentation updated?
  • [x] Changelog updated?

takahashim avatar Dec 31 '24 11:12 takahashim

I just had the same issue. Very interesting failure mode.

Ruby 3.3.2

image

vs

Ruby 3.4.1

image

stillhart avatar Feb 26 '25 15:02 stillhart