aserafin / grape_logging

Request logging for Grape!
MIT License
147 stars 76 forks source link

[question] Can I include multiple log levels instead of just one? #44

Closed alilland closed 3 years ago

alilland commented 6 years ago
class API < Grape::API
  # ...
  logger.formatter = GrapeLogging::Formatters::Default.new
  log_file = File.open('./log/logfile.log', 'a')
  log_file.sync = true
  logger Logger.new GrapeLogging::MultiIO.new(STDOUT, log_file)
  insert_after Rack::Head, GrapeLogging::Middleware::RequestLogger, logger: logger, log_level: :info, include: [
    GrapeLogging::Loggers::ClientEnv.new,
    GrapeLogging::Loggers::RequestHeaders.new
  ]

  # ...
end

If I am understanding the readme file correctly, I am only able to specify one log log level, is there a way to specify multiple? And if there is, can it be added to the readme , that would be amazing :)

aserafin commented 3 years ago

you cannot specify multiple log levels at the same time; though if specify for example DEBUG it will log DEBUG and higher up (so INFO, ERROR etc)