Sha256: 533f3198672cc44130dc9f3da0325af967fc60fb85319a716c206840cde7e700
Contents?: true
Size: 896 Bytes
Versions: 2
Compression:
Stored size: 896 Bytes
Contents
require 'sshkit' require 'logger' module Capistrano module Smartlogging class Formatter < SSHKit::Formatter::Pretty def initialize(oio) logger = CustomLogger.new(Smartlogging.configuration.log_file) logger.oio = oio logger.info("==================================================================") logger.info("* stage: #{env.fetch(:stage)}") logger.info("* start date: #{DateTime.now}") logger.info("==================================================================") super(logger) end alias_method :origin_write, :write if method_defined?(:write) def write(obj) origin_write(obj) end alias :<< :write end class CustomLogger < Logger attr_accessor :oio def <<(msg) oio ? oio.write(msg) : $stdout.write(msg) info(msg) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
capistrano-smartlogging-0.1.1 | lib/capistrano/smartlogging/formatter.rb |
capistrano-smartlogging-0.1.0 | lib/capistrano/smartlogging/formatter.rb |