Class: Embulk::Logger

Inherits:
Object
  • Object
show all
Defined in:
embulk-core/src/main/ruby/embulk/logger.rb

Defined Under Namespace

Modules: Adapter

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Logger

Returns a new instance of Logger



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'embulk-core/src/main/ruby/embulk/logger.rb', line 8

def initialize(*args)
  if args.length == 1
    a = args[0]
    if a.is_a?(Adapter)
      @logger = a
    elsif a.is_a?(::Logger)
      @logger = StandardLoggerAdapter.new(a)
    elsif RUBY_PLATFORM =~ /java/i && (org.slf4j.Logger rescue nil) && a.is_a?(org.slf4j.Logger)
      @logger = Slf4jAdapter.new(a)
    else
      @logger = StandardLoggerAdapter.new(*args)
    end
  else
    @logger = StandardLoggerAdapter.new(*args)
  end
end

Instance Method Details

#debug(message = nil, &block) ⇒ Object



31
# File 'embulk-core/src/main/ruby/embulk/logger.rb', line 31

def debug(message=nil, &block) @logger.debug(message, &block) end

#debug?Boolean

Returns:

  • (Boolean)


37
# File 'embulk-core/src/main/ruby/embulk/logger.rb', line 37

def debug?() @logger.debug? end

#error(message = nil, &block) ⇒ Object



28
# File 'embulk-core/src/main/ruby/embulk/logger.rb', line 28

def error(message=nil, &block) @logger.error(message, &block) end

#error?Boolean

Returns:

  • (Boolean)


34
# File 'embulk-core/src/main/ruby/embulk/logger.rb', line 34

def error?() @logger.error? end

#info(message = nil, &block) ⇒ Object



30
# File 'embulk-core/src/main/ruby/embulk/logger.rb', line 30

def info(message=nil, &block) @logger.info(message, &block) end

#info?Boolean

Returns:

  • (Boolean)


36
# File 'embulk-core/src/main/ruby/embulk/logger.rb', line 36

def info?() @logger.info? end

#trace(message = nil, &block) ⇒ Object



32
# File 'embulk-core/src/main/ruby/embulk/logger.rb', line 32

def trace(message=nil, &block) @logger.trace(message, &block) end

#trace?Boolean

Returns:

  • (Boolean)


38
# File 'embulk-core/src/main/ruby/embulk/logger.rb', line 38

def trace?() @logger.trace? end

#warn(message = nil, &block) ⇒ Object



29
# File 'embulk-core/src/main/ruby/embulk/logger.rb', line 29

def warn(message=nil, &block) @logger.warn(message, &block) end

#warn?Boolean

Returns:

  • (Boolean)


35
# File 'embulk-core/src/main/ruby/embulk/logger.rb', line 35

def warn?() @logger.warn? end