Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 71 lines (69 sloc) 1.727 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
# Add custom log formatters
#
# Passing a hash or a array of hashes with custom log formatters.
#
# Add the following to your deploy.rb or in your ~/.caprc
#
# == Example:
#
# capistrano_log_formatters = [
# { :match => /command finished/, :color => :hide, :priority => 10, :prepend => "$$$" },
# { :match => /executing command/, :color => :blue, :priority => 10, :style => :underscore, :timestamp => true },
# { :match => /^transaction: commit$/, :color => :magenta, :priority => 10, :style => :blink },
# { :match => /git/, :color => :white, :priority => 20, :style => :reverse }
# ]
#
# format_logs capistrano_log_formatters
#
# You can call format_logs multiple times, with either a hash or an array of hashes.
#
# == Colors:
#
# :color can have the following values:
#
# * :hide (hides the row completely)
# * :none
# * :black
# * :red
# * :green
# * :yellow
# * :blue
# * :magenta
# * :cyan
# * :white
#
# == Styles:
#
# :style can have the following values:
#
# * :bright
# * :dim
# * :underscore
# * :blink
# * :reverse
# * :hidden
#
#
# == Text alterations
#
# :prepend gives static text to be prepended to the output
# :replace replaces the matched text in the output
# :timestamp adds the current time before the output

module Capistrano
  class Configuration
    module LogFormatters
      def log_formatter(options)
        if options.class == Array
          options.each do |option|
            Capistrano::Logger.add_formatter(option)
          end
        else
          Capistrano::Logger.add_formatter(options)
        end
      end

      def disable_log_formatters
        @logger.disable_formatters = true
      end
    end
  end
end
Something went wrong with that request. Please try again.