ruby Logger日志
1.logger创建 # 输出到标准输出 logger = Logger.new(STDERR) logger = Logger.new(STDOUT) # 输出到指定文件 logger = Logger.new( ' logfile.log ' ) # 输出到指定打开/创建模式的文件 file = File.open( ' foo.log ' , File::WRONLY | File::APPEND | File::CREAT) # To create new (and to remove old) logfile, add File::CREAT like: # file = File.open('foo.log', File::WRONLY | File::APPEND | File::CREAT) logger = Logger.new(file) # 指定日志大小及保留日志个数 logger = Logger.new( ' foo.log ' , 10, 1024000 ) # 日志生成周期 logger = Logger.new('foo.log', 'daily') logger = Logger.new('foo.log', 'weekly') logger = Logger.new('foo.log', 'monthly') 2.设置日志级别 logger