Class: Jenkins::Model::Listener

Inherits:
Object
  • Object
show all
Defined in:
lib/jenkins/model/listener.rb

Overview

Receive/Send events about a running task

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(native = nil) ⇒ Listener

Returns a new instance of Listener.



13
14
15
16
# File 'lib/jenkins/model/listener.rb', line 13

def initialize(native = nil)
  @native = native
  @level = Logger::DEBUG
end

Instance Attribute Details

#levelObject

Returns the value of attribute level.



11
12
13
# File 'lib/jenkins/model/listener.rb', line 11

def level
  @level
end

#nativeObject (readonly)

the underlying hudson.model.TaskListener object



10
11
12
# File 'lib/jenkins/model/listener.rb', line 10

def native
  @native
end

Instance Method Details

#<<(msg) ⇒ Object



31
32
33
# File 'lib/jenkins/model/listener.rb', line 31

def <<(msg)
  logger.println(msg.to_s)
end

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



24
# File 'lib/jenkins/model/listener.rb', line 24

def debug(msg = nil, &block);   add(Logger::DEBUG,   msg, &block); end

#debug?Boolean

Returns:

  • (Boolean)


18
# File 'lib/jenkins/model/listener.rb', line 18

def debug?; @level <= DEBUG; end

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



27
# File 'lib/jenkins/model/listener.rb', line 27

def error(msg = nil, &block);   add(Logger::ERROR,   msg, &block); end

#error?Boolean

Returns:

  • (Boolean)


21
# File 'lib/jenkins/model/listener.rb', line 21

def error?; @level <= ERROR; end

#fatal(msg = nil, &block) ⇒ Object



28
# File 'lib/jenkins/model/listener.rb', line 28

def fatal(msg = nil, &block);   add(Logger::FATAL,   msg, &block); end

#fatal?Boolean

Returns:

  • (Boolean)


22
# File 'lib/jenkins/model/listener.rb', line 22

def fatal?; @level <= FATAL; end

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



25
# File 'lib/jenkins/model/listener.rb', line 25

def info(msg = nil, &block);    add(Logger::INFO,    msg, &block); end

#info?Boolean

Returns:

  • (Boolean)


19
# File 'lib/jenkins/model/listener.rb', line 19

def info?;  @level <= INFO;  end

#unknown(msg = nil, &block) ⇒ Object



29
# File 'lib/jenkins/model/listener.rb', line 29

def unknown(msg = nil, &block); add(Logger::UNKNOWN, msg, &block); end

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



26
# File 'lib/jenkins/model/listener.rb', line 26

def warn(msg = nil, &block);    add(Logger::WARN,    msg, &block); end

#warn?Boolean

Returns:

  • (Boolean)


20
# File 'lib/jenkins/model/listener.rb', line 20

def warn?;  @level <= WARN;  end