diff options
Diffstat (limited to 'jni/ruby/sample/logger/log.rb')
-rw-r--r-- | jni/ruby/sample/logger/log.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/jni/ruby/sample/logger/log.rb b/jni/ruby/sample/logger/log.rb new file mode 100644 index 0000000..aab80e4 --- /dev/null +++ b/jni/ruby/sample/logger/log.rb @@ -0,0 +1,27 @@ +#!/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) |