自定义类LoggerClass代码
来源:互联网 发布:华为定时开关机软件 编辑:程序博客网 时间:2024/06/07 14:56
贴出自定义类LoggerClass代码:
require 'watir'
require 'logger'
require 'watir/logger'
class LoggerFactory
def LoggerFactory.start_default_logger(fileNamePrefix)
time = Time.now.strftime("%Y%m%d%H%M%S")
logger = CoreLogger.new(File.join(File.dirname(__FILE__), "..//TestLog//#{fileNamePrefix}_#{time}.txt") ,2, 1000000)
return logger
end
end
#this logs anything that Watir.rb tries to log, and everything with a "log" method to a text
#file that can be used for debugging.
class CoreLogger < Watir::WatirLogger
def initialize(fileName, logsToKeep, maxLogSize)
super(fileName , logsToKeep, maxLogSize)
self.level = Logger::INFO
self.datetime_format = "%Y-%m%-%d %H:%M:%S"
self.info("Core Logger starting...")
end
#overloaded "log" from logger.rb to something more intuitive.
def log(message)
puts "log #{message}/n" #optional. comment out if you don't want to see logging in the console
info(message) #calls info in logger.rb -- would be good to use different logging levels
end
end
- 自定义类LoggerClass代码
- 自定义类ReportClass代码
- 自定义类库代码分析
- IIS6.0日志文件自定义类代码
- 自定义类的数组排序代码
- java代码无法解析自定义类
- 天猫商城应用自定义类代码
- 自定义一个异常类模板代码实例
- 4-1、自定义InputFormat 类代码
- IntelliJ IDEA 类代码模板注解自定义
- ZendStudio自定义代码不全,自定义代码段
- UITableViewCell自定义--代码自定义 和 xib自定义
- 超级链接自定义控件代码
- 自定义TabControl全部代码
- 添加自定义事务代码
- 代码生成器自定义模板
- eclipase 自定义代码折叠
- ASM_6自定义中断[代码]
- position:relative
- Android开发中用到的命令——整理贴
- Android高手进阶教程(二十一)之---Android中创建与几种解析xml的方法!
- opensolaris如何让网络设置持久化
- JavaScript Array(数组)对象
- 自定义类LoggerClass代码
- andriod git repo 使用方法
- 驱动程序访问用户模式数据缓冲区的三种方式
- 常用电脑检测软件列表!提供下载!
- sql手记
- curl使用简介
- ORA-22992 cannot use LOB locators selected from remote tables(转)
- WebService调用Session
- Ubuntu Linux系统下Apt-get命令参数详解