Top Level Namespace
Defined Under Namespace
Modules: DottedIndex, Enumerable, Irc, Net, Singleton
Classes: AgentPlugin, Array, ArrayOf, AuthModule, BasicsModule, ConfigModule, DispatchServlet, Exception, FiltersModule, GetTextVersionError, HttpUtilPlugin, IrcLogModule, Module, Numeric, Object, Range, Regexp, ServerError, ServerMessageParseError, String, Symbol, Timer, UnicodePlugin, UrlLinkError, UserDataModule, WebServiceModule, WebServiceUser, WordlistModule
Instance Method Summary
(collapse)
Instance Method Details
- (Object) debug(message = nil, who_pos = 1)
111
112
113
|
# File '/home/apoc/projects/ruby/rbot/lib/rbot/ircbot.rb', line 111
def debug(message=nil, who_pos=1)
rawlog(Logger::Severity::DEBUG, message, who_pos)
end
|
- (Object) error(message = nil, who_pos = 1)
123
124
125
|
# File '/home/apoc/projects/ruby/rbot/lib/rbot/ircbot.rb', line 123
def error(message=nil, who_pos=1)
rawlog(Logger::Severity::ERROR, message, who_pos)
end
|
- (Object) fatal(message = nil, who_pos = 1)
127
128
129
|
# File '/home/apoc/projects/ruby/rbot/lib/rbot/ircbot.rb', line 127
def fatal(message=nil, who_pos=1)
rawlog(Logger::Severity::FATAL, message, who_pos)
end
|
- (Object) halt_logger
76
77
78
79
80
81
82
|
# File '/home/apoc/projects/ruby/rbot/lib/rbot/ircbot.rb', line 76
def halt_logger
if $log_thread && $log_thread.alive?
$log_queue << nil
$log_thread.join
$log_thread = nil
end
end
|
- (Object) log(message = nil, who_pos = 1)
115
116
117
|
# File '/home/apoc/projects/ruby/rbot/lib/rbot/ircbot.rb', line 115
def log(message=nil, who_pos=1)
rawlog(Logger::Severity::INFO, message, who_pos)
end
|
- (Object) log_session_end
106
107
108
109
|
# File '/home/apoc/projects/ruby/rbot/lib/rbot/ircbot.rb', line 106
def log_session_end
$logger << "\n\n=== #{botclass} session ended on #{Time.now.strftime($dateformat)} ===\n\n"
$log_queue << nil
end
|
- (Object) log_session_start
101
102
103
104
|
# File '/home/apoc/projects/ruby/rbot/lib/rbot/ircbot.rb', line 101
def log_session_start
$logger << "\n\n=== #{botclass} session started on #{Time.now.strftime($dateformat)} ===\n\n"
restart_logger
end
|
- (Object) pretty_inspect
28
29
30
|
# File '/home/apoc/projects/ruby/rbot/lib/rbot/ircbot.rb', line 28
def pretty_inspect
PP.pp(self, '')
end
|
- (Object) rawlog(level, message = nil, who_pos = 1)
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
# File '/home/apoc/projects/ruby/rbot/lib/rbot/ircbot.rb', line 48
def rawlog(level, message=nil, who_pos=1)
call_stack = caller
if call_stack.length > who_pos
who = call_stack[who_pos].sub(%r{(?:.+)/([^/]+):(\d+)(:in .*)?}) { "#{$1}:#{$2}#{$3}" }
else
who = "(unknown)"
end
case message
when String
str = message
else
str = message.pretty_inspect rescue '?'
end
qmsg = Array.new
str.each_line { |l|
qmsg.push [level, l.chomp, who]
who = ' ' * who.size
}
if level == Logger::Severity::ERROR or level == Logger::Severity::FATAL and not $daemonize
$stderr.puts str
end
$log_queue.push qmsg
end
|
- (Object) restart_logger(newlogger = false)
86
87
88
89
90
91
92
93
94
95
96
97
|
# File '/home/apoc/projects/ruby/rbot/lib/rbot/ircbot.rb', line 86
def restart_logger(newlogger = false)
halt_logger
$logger = newlogger if newlogger
$log_thread = Thread.new do
ls = nil
while ls = $log_queue.pop
ls.each { |l| $logger.add(*l) }
end
end
end
|
- (Object) warning(message = nil, who_pos = 1)
119
120
121
|
# File '/home/apoc/projects/ruby/rbot/lib/rbot/ircbot.rb', line 119
def warning(message=nil, who_pos=1)
rawlog(Logger::Severity::WARN, message, who_pos)
end
|