Improve shell command logging