Output logs only when debugging.
Made hosts and ports configurable.