Module: GitWorkflow::Logging

Included in:
Commands::Base, Git::Repository, Story
Defined in:
lib/git_workflow/logging.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.default_loggerObject



46
47
48
# File 'lib/git_workflow/logging.rb', line 46

def default_logger
  Log4r::Logger['Console']
end

.included(base) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/git_workflow/logging.rb', line 19

def self.included(base)
  base.instance_eval do
    extend ClassMethods

    [ :debug, :info, :error ].each do |level|
      class_eval <<-END_OF_LOGGING_METHOD
        def #{ level }(message, &block)
          self.class.#{ level }(message, &block)
        end

        def self.#{ level }(message, &block)
          self.log(#{ level.inspect }, message, &block)
        end
      END_OF_LOGGING_METHOD
    end
  end
end

.loggerObject



42
43
44
# File 'lib/git_workflow/logging.rb', line 42

def logger
  @logger ||= default_logger
end

.logger=(logger) ⇒ Object



38
39
40
# File 'lib/git_workflow/logging.rb', line 38

def logger=(logger)
  @logger = logger
end