Module: Fieldhand::Logger
- Defined in:
- lib/fieldhand/logger.rb
Overview
A default null logger for discarding log messages.
Class Method Summary collapse
-
.null ⇒ Object
Return a new ‘Logger` that logs to the null device on this platform.
-
.null_device ⇒ Object
Determine the null device on this platform, a backport of more recent Rubies’ File::NULL See github.com/marcandre/backports/blob/v3.8.0/lib/backports/1.9.3/file/null.rb.
Class Method Details
.null ⇒ Object
Return a new ‘Logger` that logs to the null device on this platform.
12 13 14 |
# File 'lib/fieldhand/logger.rb', line 12 def null ::Logger.new(null_device) end |
.null_device ⇒ Object
Determine the null device on this platform, a backport of more recent Rubies’ File::NULL See github.com/marcandre/backports/blob/v3.8.0/lib/backports/1.9.3/file/null.rb
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/fieldhand/logger.rb', line 18 def null_device platform = ::RUBY_PLATFORM platform = ::RbConfig::CONFIG['host_os'] if platform == 'java' case platform when /mswin|mingw/i then 'NUL' when /amiga/i then 'NIL:' when /openvms/i then 'NL:' else '/dev/null' end end |