Class: TingYun::Logger::MemoryLogger
- Inherits:
-
Object
- Object
- TingYun::Logger::MemoryLogger
show all
- Includes:
- LogOnce
- Defined in:
- lib/ting_yun/logger/memory_logger.rb
Constant Summary
Constants included
from LogOnce
LogOnce::NUM_LOG_ONCE_KEYS
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from LogOnce
#clear_already_logged, #log_once
Constructor Details
Returns a new instance of MemoryLogger.
11
12
13
14
15
16
|
# File 'lib/ting_yun/logger/memory_logger.rb', line 11
def initialize
@already_logged_lock = Mutex.new
clear_already_logged
@messages = []
end
|
Instance Attribute Details
#level ⇒ Object
Returns the value of attribute level.
22
23
24
|
# File 'lib/ting_yun/logger/memory_logger.rb', line 22
def level
@level
end
|
Returns the value of attribute log_formatter.
22
23
24
|
# File 'lib/ting_yun/logger/memory_logger.rb', line 22
def log_formatter
@log_formatter
end
|
#messages ⇒ Object
Returns the value of attribute messages.
22
23
24
|
# File 'lib/ting_yun/logger/memory_logger.rb', line 22
def messages
@messages
end
|
Instance Method Details
#debug(*msgs, &blk) ⇒ Object
40
41
42
|
# File 'lib/ting_yun/logger/memory_logger.rb', line 40
def debug(*msgs, &blk)
messages << [:debug, msgs, blk]
end
|
#dump(logger) ⇒ Object
48
49
50
51
52
53
|
# File 'lib/ting_yun/logger/memory_logger.rb', line 48
def dump(logger)
messages.each do |(method, args, blk)|
logger.send(method, *args, &blk)
end
messages.clear
end
|
#error(*msgs, &blk) ⇒ Object
28
29
30
|
# File 'lib/ting_yun/logger/memory_logger.rb', line 28
def error(*msgs, &blk)
messages << [:error, msgs, blk]
end
|
#fatal(*msgs, &blk) ⇒ Object
24
25
26
|
# File 'lib/ting_yun/logger/memory_logger.rb', line 24
def fatal(*msgs, &blk)
messages << [:fatal, msgs, blk]
end
|
#info(*msgs, &blk) ⇒ Object
36
37
38
|
# File 'lib/ting_yun/logger/memory_logger.rb', line 36
def info(*msgs, &blk)
messages << [:info, msgs, blk]
end
|
#is_startup_logger? ⇒ Boolean
18
19
20
|
# File 'lib/ting_yun/logger/memory_logger.rb', line 18
def is_startup_logger?
true
end
|
#log_exception(level, e, backtrace_level = level) ⇒ Object
44
45
46
|
# File 'lib/ting_yun/logger/memory_logger.rb', line 44
def log_exception(level, e, backtrace_level=level)
messages << [:log_exception, [level, e, backtrace_level]]
end
|
#warn(*msgs, &blk) ⇒ Object
32
33
34
|
# File 'lib/ting_yun/logger/memory_logger.rb', line 32
def warn(*msgs, &blk)
messages << [:warn, msgs, blk]
end
|