Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set @level_override to fix Ruby HEAD compatibility
Browse files Browse the repository at this point in the history
ruby/logger#85 added this to the `Logger` initializer.

Since we don't call `super` in `initialize`, we need to do it ourselves.

Not doing this leads to an error in `Logger#level`:

    # undefined method `[]' for nil:NilClass (NoMethodError):

    def level
      @level_override[Fiber.current] || @Level
      #              ^^^^^^^^^^^^^^^
    end
sambostock committed Feb 15, 2023
1 parent bd8b99d commit d54657b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/mono_logger.rb
Original file line number Diff line number Diff line change
@@ -30,6 +30,7 @@ class MonoLogger < Logger
def initialize(logdev, shift_age=nil, shift_size=nil)
@progname = nil
@level = DEBUG
@level_override = {}
@default_formatter = Formatter.new
@formatter = nil
@logdev = nil

0 comments on commit d54657b

Please sign in to comment.