Class: UmfLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/UmfLogger.rb

Class Method Summary collapse

Class Method Details

.logInfoMsg(msg) ⇒ Object

写入info类型日志到日志文件



12
13
14
15
16
17
18
19
20
21
# File 'lib/UmfLogger.rb', line 12

def UmfLogger.logInfoMsg(msg)
  if UmfConfig.umf_log_switch
    filePath = UmfConfig.umf_log_path + "-" + Time.new.strftime("%Y-%m-%d") + ".txt"
    #msgHead = Time.new.strftime("%Y-%m-%d %H:%M:%S") + " "

    #msg = msgHead + msg

    file = File.open(filePath, File::APPEND | File::CREAT | File::WRONLY)
    logger = Logger.new(file)
    logger.info(msg)
  end
end