Adding an environment variable to control whether our log writes to stdout and properly moved to using $stdout and $stderr for our output.