module Async

def self.measure(*args, threshold: 1.0, &block)

def self.measure(*args, threshold: 1.0, &block)
	result = nil
	
	duration = Benchmark.realtime do
		result = yield
	end
	
	return result
ensure
	if duration && duration > threshold
		warn "#{args.join(' ')} took #{duration}s"
	end
end

def self.run(*args, &block)

Invoke `Reactor.run` with all arguments/block.
def self.run(*args, &block)
	Reactor.run(*args, &block)
end

def default_log_level

Set the default log level based on `$DEBUG` and `$VERBOSE`.
def default_log_level
	if $DEBUG
		Logger::DEBUG
	elsif $VERBOSE
		Logger::INFO
	else
		Logger::WARN
	end
end