Class: Object

Inherits:
BasicObject
Defined in:
lib/dlog.rb

Instance Method Summary collapse

Instance Method Details

#benchmark(*args, &block) ⇒ Object



284
285
286
287
288
289
290
291
292
# File 'lib/dlog.rb', line 284

def benchmark(*args, &block)
  if Dlog.quiet?
    Dlog::NoBenchmark
  elsif args.empty? && !block_given?
    Dlog::Benchmark 
  else
    Dlog::Benchmark.benchmark :info, args, &block
  end
end

#benchslow(*args, &block) ⇒ Object



294
295
296
297
298
299
300
301
302
# File 'lib/dlog.rb', line 294

def benchslow(*args, &block)
  if Dlog.quiet?
    Dlog::NoBenchmark
  elsif args.empty? && !block_given?
    Dlog::Benchslow 
  else
    Dlog::Benchslow.benchmark :info, args, &block
  end
end

#dlog(*args) ⇒ Object



262
263
264
265
266
267
268
269
270
271
# File 'lib/dlog.rb', line 262

def dlog(*args)
  quiet = Dlog.quiet? || Dlog.release?
  
  if args.empty?
    quiet ? Dlog::Nolog : Dlog
  else
    Dlog.log :info, args unless quiet
    args.last
  end 
end

#rlog(*args) ⇒ Object



273
274
275
276
277
278
279
280
281
282
# File 'lib/dlog.rb', line 273

def rlog(*args)
  quiet = Dlog.quiet?
  
  if args.empty?
    quiet ? Dlog::Nolog : Dlog
  else
    Dlog.log :warn, args unless quiet
    args.last
  end 
end