Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 24 lines (20 sloc) 0.5 kB
6437cd4 @sevk 小优化.
authored
1 #!/usr/bin/env ruby
97f5fa6 @sevk 优化.
authored
2 # sevkme@gmail.com
3
4 require 'logger'
82101d4 优化断线重连
kk@ub3 authored
5 Dir.mkdir 'log' if not Dir.exist? 'log'
97f5fa6 @sevk 优化.
authored
6
7 #记录到日志文件,参数是要记录的内容,不给参数则记录当前错误描述,未出错就是空。
c10da57 小优化.
kk on ub1 authored
8 def log(s=nil)
9 if not s
10 if $!
6980299 写入聊天记录。
kk on ub1 authored
11 s = "#{$!.message} #{$@.join("\n")}"
c10da57 小优化.
kk on ub1 authored
12 else
13 return
14 end
15 end
16 puts s.to_s
17 #daily/weekly/monthly.
18 logger = Logger.new("./log/log_#{ENV['USER']}.log",shift_age=30,10240000)
25b3150 @sevk 小优化 "\n" . windows 下面应该不会连接时不动了。
authored
19 logger.level = Logger::DEBUG
c10da57 小优化.
kk on ub1 authored
20 logger.debug{s}
97f5fa6 @sevk 优化.
authored
21 end
c10da57 小优化.
kk on ub1 authored
22 log('start.')
97f5fa6 @sevk 优化.
authored
23
Something went wrong with that request. Please try again.