Use Lumberjack as logger #345

Merged
merged 9 commits into from Oct 22, 2012

Conversation

Projects
None yet
4 participants
Contributor

netzpirat commented Oct 19, 2012

This pull request makes use of Lumberjack as a logger, and adds a corresponding logger DSL method, so you can customize the logging behavior to your needs.

From the README:

logger

The logger method allows you to customize the Guard log output to your needs by specifying one or more options like:

logger :level       => :warn,
       :template    => '[:severity - :time - :progname] :message',
       :time_format => 'at %I:%M%p',
       :only        => [:rspec, :jasmine, 'coffeescript'],
       :except      => :jammit

Log :level option must be either :debug, :info, :warn or :error. If Guard is started in debug mode, the log level will be automatically set to :debug.

The :template option is a string which can have one or more of the following placeholders: :time, :severity, :progname, :pid, :unit_of_work_id and :message. A unit of work is assigned for each action Guard performs on multiple Guard plugin.

The :time_format option directives are the same as Time#strftime or can be :milliseconds

The :only and :except are either a string or a symbol, or an array of strings or symbols that matches the name of
the Guard plugin name that sends the log message. They cannot be specified at the same time.

netzpirat added some commits Oct 18, 2012

Implement logger options.
This implements the following logger options through the DSL:

* level
* template
* time_format
* only
* except

To make the new options testable, the TEST env guard has been removed from
the UI class and therefore all the log messages have been stubbed out from all
specs.
Contributor

netzpirat commented Oct 19, 2012

This addresses issue #277

Owner

thibaudgg commented Oct 19, 2012

Sounds awesome!

Owner

rymai commented Oct 19, 2012

Awesome!

Shouldn't the :only and :except option accept a string/symbol or array of strings/symbols instead of a regex?

e.g. :only => ['rspec', :test, :livereload]

Contributor

netzpirat commented Oct 19, 2012

Nice idea! More Rails like and simpler. I'll change that...

@netzpirat netzpirat merged commit 06b91bc into master Oct 22, 2012

1 check passed

default The Travis build passed
Details

Coverage Status

Changes Unknown when pulling 06b91bc on logger/lumberjack into * on master*.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment