Grape logger invalid
Open
Nobody has claimed this yet.
needs info
- Dominant language
- Ruby
- Stars
- 10k
- Forks
- 1.2k
- Avg merge
- 14h 38m
- Merged PRs (30d)
- 92
Description
in lib/grape/dsl/logger.rb, we can see:
module Grape
module DSL
module Logger
include Grape::DSL::Settings
attr_writer :logger
# Set or retrive the configured logger. If none was configured, this
# method will create a new one, logging to stdout.
# @param logger [Object] the new logger to use
def logger(logger = nil)
if logger
global_setting(:logger, logger)
else
global_setting(:logger) || global_setting(:logger, ::Logger.new($stdout))
end
end
end
end
end
Here is a problem, we can not set logger by Grape::API.logger = xxx, instead, we should call Grape::API.logger(xxx).
Seems something wrong with the attribute writter 'logger=' ?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read lib/grape/dsl/logger.rb, starting with the logger method and the attr_writer :logger declaration, then check how Grape::API.logger= and Grape::API.logger(xxx) resolve. Confirm that assignment configures the logger as intended without breaking the existing method form.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100