def debug
    return unless @debug
    message = Thread.current.to_s + ' ' + yield
    if defined?(Syslog) and Syslog.opened?
      Syslog.debug(message)
    else
      STDERR << 'syncache: ' + message + "\n"
      STDERR.flush
    end
  end
def debug
    return unless @debug
    message = Thread.current.to_s + ' ' + yield
    if defined?(Syslog) and Syslog.opened?
      Syslog.debug(message)
    else
      STDERR << 'syncache: ' + message + "\n"
      STDERR.flush
    end
  end
send debug output to syslog if enabled