Module: MakeMakefile::Logging
- 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 collapse
-
.quiet ⇒ Object
Returns the value of attribute quiet.
Class Method Summary collapse
- .log_close ⇒ Object
- .log_open ⇒ Object
- .log_opened? ⇒ Boolean
- .logfile(file) ⇒ Object
- .message(*s) ⇒ Object
- .open ⇒ Object
- .postpone ⇒ Object
Class Attribute Details
.quiet ⇒ Object
Returns the value of attribute quiet.
382 383 384 |
# File 'lib/mkmf.rb', line 382 def quiet @quiet end |
Class Method Details
.log_close ⇒ Object
356 357 358 359 360 361 362 |
# File 'lib/mkmf.rb', line 356 def self::log_close if @log and not @log.closed? @log.flush @log.close @log = nil end end |
.log_open ⇒ Object
327 328 329 330 |
# File 'lib/mkmf.rb', line 327 def self::log_open @log ||= File::open(@logfile, 'wb') @log.sync = true end |
.log_opened? ⇒ Boolean
332 333 334 |
# File 'lib/mkmf.rb', line 332 def self::log_opened? @log and not @log.closed? end |
.logfile(file) ⇒ Object
351 352 353 354 |
# File 'lib/mkmf.rb', line 351 def self::logfile file @logfile = file log_close end |
.message(*s) ⇒ Object
346 347 348 349 |
# File 'lib/mkmf.rb', line 346 def self::(*s) log_open @log.printf(*s) end |
.open ⇒ Object
336 337 338 339 340 341 342 343 344 |
# File 'lib/mkmf.rb', line 336 def self::open log_open $stderr.reopen(@log) $stdout.reopen(@log) yield ensure $stderr.reopen(@orgerr) $stdout.reopen(@orgout) end |
.postpone ⇒ Object
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 |
# File 'lib/mkmf.rb', line 364 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 |