new(logdev, shift_age = 0, shift_size = 1048576, level: Logger::Severity::DEBUG, progname: nil, formatter: Formatter.new, datetime_format: nil, shift_period_suffix: '%Y%m%d') -> Logger
[permalink][rdoc]Logger オブジェクトを生成します。
例:
require '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) logger = Logger.new(file, 'daily') logger = Logger.new(file, level: :info) logger = Logger.new(file, progname: 'progname') logger = Logger.new(file, formatter: formatter) logger = Logger.new(file, datetime_format: '%Y-%m-%d %H:%M:%S')