use a byte-buffer, allow logging while piping to file, remove API-key-commandline-stuff