Allow hostname to be set, defaults to os.Hostname.