101 configuration with yaml

Rudolf Schmidt edited this page Jun 20, 2013 · 12 revisions

Yell 101 - How To: Configuration with YAML

Since version 0.10.0 you can configure Yell via a YAML file. You may place it into config/yell.yml.

A regular config may look like so:

# config/yell.yml

    - :file:
        :filename: 'log/development.log'

  :level: 'gte.info'

    - :datefile:
        :level: 'lte.warn'
        :filename: 'log/production.log'
    - :datefile:
        :level: 'gte.error'
        :filename: 'log/error.log'

Basically, it means that Yell will write any messages for the development environment into the development.log file. For the production environment it will write any messages from :info to :warn into the production.YYYY-MM-DD.log file and any messages from :error onwards into the error.YYY-MM-DD.log file. YYYY-MM-DD means the Year-month-date of your current time format.

Now, given your the configuration is placed in config/yell.yml, you can initialize a Yell instance via:

Yell.load! 'config/yell.yml'

NOTE If you are using the yell-rails gem, it will expect a configuration file in config/yell.yml or otherwise will prompt you to create one. In case a YAML file is present, it will initialize the Rails logger from that location.