logdna / ruby

Ruby library for logging to LogDNA
MIT License
17 stars 20 forks source link

Argument Error Invalid log level #24

Closed mansoorelahi closed 4 years ago

mansoorelahi commented 4 years ago

There seems to be some issue with the library when used as config.logger = Logdna::Ruby.new("key", options={} ) as per the README its showing the below error .rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/logger.rb:284:in `level=': invalid log level: (ArgumentError)

mansoorelahi commented 4 years ago

Any update on it @vilyapilya should we write a custom error handler and ditch the rails supports ?

vilyapilya commented 4 years ago

@mansoorelahi can you please give us more information on how you use the logger in your code?

vilyapilya commented 4 years ago

@mansoorelahi Actually I see what the issue is. I was able to reproduce it. Ruby just tries to use its own logger and initialize the Logger class and does not really reassign config.logger. Try to use a different name instead of 'logger'. For example config.logdnaLogger = Logdna::Ruby.new(key, options)

and then you can use it in your application like so : Rails.configuration.logdnaLogger.log("my log message")

vidurangaw commented 4 years ago

@vilyapilya Same thing happens to me, but the workaround you provided is not good for us.

We basically need to replace the default logger with logdna so it captures all the logs. Could you please look into this? Thanks!

vilyapilya commented 4 years ago

@mansoorelahi , @vidurangaw we will release the fix next week.

vilyapilya commented 4 years ago

@mansoorelahi , @vidurangaw the fix is in the v1.4.1