Module: MakeMakefile::Logging
Do not use. This module is for internal use only.
Relationships & Source Files | |
Defined in: | lib/mkmf.rb |
Overview
This is a custom logging module. It generates an mkmf.log file when you run your extconf.rb script. This can be useful for debugging unexpected failures.
This module and its associated methods are meant for internal use only.
Class Attribute Summary
- .log_opened? ⇒ Boolean readonly
- .quiet rw
Class Method Summary
Class Attribute Details
.log_opened? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/mkmf.rb', line 306
def self::log_opened? @log and not @log.closed? end
.quiet (rw)
[ GitHub ]# File 'lib/mkmf.rb', line 356
attr_accessor :quiet
Class Method Details
.log_close
[ GitHub ]# File 'lib/mkmf.rb', line 330
def self::log_close if @log and not @log.closed? @log.flush @log.close @log = nil end end
.log_open
[ GitHub ]# File 'lib/mkmf.rb', line 301
def self::log_open @log ||= File::open(@logfile, 'wb') @log.sync = true end
.logfile(file)
[ GitHub ]# File 'lib/mkmf.rb', line 325
def self::logfile file @logfile = file log_close end
.message(*s)
[ GitHub ]# File 'lib/mkmf.rb', line 320
def self:: (*s) log_open @log.printf(*s) end
.open
[ GitHub ]# File 'lib/mkmf.rb', line 310
def self::open log_open $stderr.reopen(@log) $stdout.reopen(@log) yield ensure $stderr.reopen(@orgerr) $stdout.reopen(@orgout) end
.postpone
[ GitHub ]# File 'lib/mkmf.rb', line 338
def self::postpone tmplog = "mkmftmp#{@postpone += 1}.log" open do log, *save = @log, @logfile, @orgout, @orgerr @log, @logfile, @orgout, @orgerr = nil, tmplog, log, log begin log.print(open {yield @log}) ensure @log.close if @log and not @log.closed? File::open(tmplog) {|t| FileUtils.copy_stream(t, log)} if File.exist?(tmplog) @log, @logfile, @orgout, @orgerr = log, *save @postpone -= 1 MakeMakefile.rm_f tmplog end end end