Module: COS::Logging

Included in:
Bucket, Download, HTTP, Slice
Defined in:
lib/cos/logging.rb

Constant Summary collapse

DEFAULT_LOG_FILE =

默认日志存储

'./cos-sdk.log'
MAX_NUM_LOG =

日志最大数量

100
ROTATE_SIZE =

日志覆盖大小

10 * 1024 * 1024

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.set_logger(file, level) ⇒ Object

设置日志输出的文件 level = Logger::DEBUG | Logger::INFO | Logger::ERROR | Logger::FATAL



18
19
20
21
22
23
24
25
26
# File 'lib/cos/logging.rb', line 18

def self.set_logger(file, level)
  if file == STDOUT or file == STDERR
    @logger = Logger.new(file)
    @logger.level = level
  else
    @logger = Logger.new(file, MAX_NUM_LOG, ROTATE_SIZE)
    @logger.level = level
  end
end

Instance Method Details

#loggerObject

获取logger



29
30
31
# File 'lib/cos/logging.rb', line 29

def logger
  Logging.logger
end