Module: Yast::Logger

Included in:
Debugger, WFM
Defined in:
src/ruby/yast/y2logger.rb

Overview

This module provides access to Yast specific logging

Examples:

Yast::Logger example

module Yast
  class Foo < Client
    include Yast::Logger

    def foo
      # this will be logged into y2log using the usual y2log format

      # Builtins.y2debug() replacement
      log.debug "debug"

      # Builtins.y2milestone() replacement
      log.info "info"

      # Builtins.y2error() replacement
      log.error "error"

      # log a logical group of commands, useful for big tasks which
      # log too many details
      log.group("Adding repositories") do
        add_repositories
      end

      # log a logical group of commands with result details
      log.group("Adding repositories") do |group|
        ret, repos = add_repositories
        if ret == :failed
          group.summary = "Could not add repositories"
          group.success = false
        else
          group.summary = "Added #{repos.size} repositories"
        end
      end
    end
  end
end

Instance Method Summary collapse

Instance Method Details

#logObject



158
159
160
# File 'src/ruby/yast/y2logger.rb', line 158

def log
  Y2Logger.instance
end