Class: MiniBot::Logger

Inherits:
Object
  • Object
show all
Defined in:
lib/minibot/logger.rb

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.levelsObject (readonly)

Returns the value of attribute levels.



10
11
12
# File 'lib/minibot/logger.rb', line 10

def levels
  @levels
end

Instance Attribute Details

#levelObject

Returns the value of attribute level.



13
14
15
# File 'lib/minibot/logger.rb', line 13

def level
  @level
end

Class Method Details

.with_level(level, &block) ⇒ Object



6
7
8
# File 'lib/minibot/logger.rb', line 6

def with_level(level, &block)
  @levels[level] = block
end

Instance Method Details

#write(str) ⇒ Object



15
16
17
18
19
# File 'lib/minibot/logger.rb', line 15

def write(str)
  time = Time.now.strftime("%Y/%m/%d %H:%M:%S")
  @target.printf "<%s> [%s] %s\n",time, level, str
  @target.flush
end