Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-4562

Accept integers for Mongoid::Config.log_level

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 7.1.0.rc0
    • Affects Version/s: None
    • Component/s: Dev Exp
    • None

      This is poor DX:

      speed% irb -rmongoid
      irb(main):001:0> Mongoid::Config.log_level
      => 1
      irb(main):002:0> Mongoid::Config.log_level=2
      => 2
      irb(main):003:0> Mongoid::Config.log_level
      Traceback (most recent call last):
              3: from /home/w/.rbenv/versions/2.5.1/bin/irb:11:in `<main>'
              2: from (irb):3
              1: from /home/w/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/mongoid-7.0.1/lib/mongoid/config/options.rb:83:in `log_level'
      NoMethodError (undefined method `upcase' for 2:Integer)
      

      If log_level is returned as an integer it should be accepted as an integer as well by the attribute writer.

            Assignee:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: