Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better configuration DSL #9

Open
gshutler opened this issue Jun 30, 2014 · 0 comments
Open

Better configuration DSL #9

gshutler opened this issue Jun 30, 2014 · 0 comments

Comments

@gshutler
Copy link
Owner

Get rid of the << style, something along the lines of this suggested by @sbellware

Hatchet.configure do |config|
  config.level :warn
  config.level :debug, 'Application::BankTransfer'

  config.appender(Hatchet::LoggerAppender.new) do |appender|
    appender.logger = Logger.new('log/application.log')
  end

  config.appender(CustomEmailAppender.new) do |appender|
    appender.level :fatal
    appender.formatter = CustomEmailFormatter.new
    appender.recipient = '[email protected]'
  end
end

May be able to avoid the .new by checking if the parameter is a class or an object to neaten up a little more in the common case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant