Module: Logging
- Defined in:
- ext/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
Class Attribute Details
.quiet ⇒ Object
Returns the value of attribute quiet.
253 254 255 |
# File 'ext/lib/mkmf.rb', line 253 def quiet @quiet end |
Class Method Details
.logfile(file) ⇒ Object
226 227 228 229 230 231 232 233 |
# File 'ext/lib/mkmf.rb', line 226 def self::logfile file @logfile = file if @log and not @log.closed? @log.flush @log.close @log = nil end end |
.message(*s) ⇒ Object
220 221 222 223 224 |
# File 'ext/lib/mkmf.rb', line 220 def self::(*s) @log ||= File::open(@logfile, 'w') @log.sync = true @log.printf(*s) end |
.open ⇒ Object
209 210 211 212 213 214 215 216 217 218 |
# File 'ext/lib/mkmf.rb', line 209 def self::open @log ||= File::open(@logfile, 'w') @log.sync = true $stderr.reopen(@log) $stdout.reopen(@log) yield ensure $stderr.reopen(@orgerr) $stdout.reopen(@orgout) end |
.postpone ⇒ Object
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
# File 'ext/lib/mkmf.rb', line 235 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.close File::open(tmplog) {|t| FileUtils.copy_stream(t, log)} ensure @log, @logfile, @orgout, @orgerr = log, *save @postpone -= 1 rm_f tmplog end end end |