Configure hook stdout (log)

An env variable (like VERBOSE, DEV_MODE) that enables the display of everything, and the preservation of SNAP_DATA in case of failure (it currently disappears) would probably make sense.

To work around the problem, I use the following pattern which probably should be documented somewhere as a best practice. Snap developers will want to see stdout and stderr during development, regardless of whether the hook script has completed successfully or not.

# in hook script
hook_dir="${SNAP_COMMON}/hooks/${SNAP_REVISION}/$(basename "$0")" && mkdir -p "${hook_dir}"

exec &> >(tee -a "${hook_dir}.log")

I also added some of the dump helpers I use in this post: