Current Path : /compat/linux/proc/self/root/usr/local/share/examples/ruby18/logger/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //compat/linux/proc/self/root/usr/local/share/examples/ruby18/logger/log.rb |
#!/usr/bin/env ruby require 'logger' log = Logger.new(STDERR) def do_log(log) log.debug('do_log1') { "debug" } log.info('do_log2') { "info" } log.warn('do_log3') { "warn" } log.error('do_log4') { "error" } log.fatal('do_log6') { "fatal" } log.unknown('do_log7') { "unknown" } end log.level = Logger::DEBUG # Default. do_log(log) puts "Set severity threshold 'WARN'." log.level = Logger::WARN do_log(log) puts "Change datetime format. Thanks to Daniel Berger." log.datetime_format = "%d-%b-%Y@%H:%M:%S" do_log(log)