Added functionality to use streams to write logs