Home

Awesome

jekyll_plugin_logger Gem Version

jekyll_plugin_logger is a Jekyll plugin, packaged as a Ruby gem, that provides colored console logs for Jekyll plugins. It is based on the standard Ruby Logger class.

Log levels are normally set from _config.yml:

Usage

The demo/_plugins/ directory demonstrates two ways of working with jekyll_plugin_logger:

Installation

To A Jekyll Website

Add the following to your Jekyll website's Gemfile:

group :jekyll_plugins do
  gem 'jekyll_plugin_logger'
end

Install all of the dependent gems of your Jekyll website by typing:

$ bundle

To A Jekyll Plugin Packaged As A Gem

Add the following to your Gem’s .gemspec:

Gem::Specification.new do |spec|
  spec.add_dependency 'jekyll_plugin_logger'
end

Install all of the dependent gems of your Gem by typing:

$ bundle

Configuration

The default log level is info. You can change the log level by editing _config.yml and adding a plugin_loggers section. Within that section, add an entry for the fully qualified name of your plugin class.

For example, the fully qualified class names of the Jekyll plugins provided in demo/_plugins/ are Raw::InlineTag and Support::InlineTag, respectively. Their log levels can be set to debug with the following entries in _config.yml:

plugin_loggers:
  Raw::InlineTag: debug     # Notice the module name is specified as well as the class name
  Support::InlineTag: debug # Notice the module name is specified as well as the class name

Run the Demo

Run the demo by typing:

$ demo/_bin/debug -r

See what happens to the output when you edit the logging levels in the plugin_loggers section of _config.yml. You will have to restart the demo after each modification to _config.yml in order to see the output change.

Additional Information

More information is available on Mike Slinn's web site about Jekyll plugins.

Development

After checking out the jekyll_plugin_logger repository, run bin/setup to install dependencies, which includes development dependencies.

You can then run bin/console for an interactive prompt that will allow you to experiment.

Build and Install Locally

To build and install this gem onto your local machine, run:

$ bundle exec rake install
jekyll_plugin_logger 1.0.0 built to pkg/jekyll_plugin_logger-0.1.0.gem.
jekyll_plugin_logger (1.0.0) installed.

Examine the newly built gem:

$ gem info jekyll_plugin_logger

*** LOCAL GEMS ***

jekyll_plugin_logger (1.0.0)
    Author: Mike Slinn
    Homepage:
    https://github.com/mslinn/jekyll_plugin_logger
    License: MIT
    Installed at: /home/mslinn/.gems

    Generates a Jekyll logger with colored output.

Build and Push to RubyGems

To release a new version,

  1. Update the version number in version.rb.

  2. Commit all changes to git; if you don't the next step might fail with an unexplainable error message.

  3. Run the following:

    $ bundle exec rake release
    

    The above creates a git tag for the version, commits the created tag, and pushes the new .gem file to RubyGems.org.

Contributing

  1. Fork the project
  2. Create a descriptively named feature branch
  3. Add your feature
  4. Submit a pull request

License

The gem is available as open source under the terms of the MIT License.