golog icon indicating copy to clipboard operation
golog copied to clipboard

Two simultaneous outputs

Open xleyba opened this issue 5 years ago • 1 comments

Hi

I would like to send the output to console by default but also send it to JSon file. I have been able to format the JSon file output but could not figure out how to have both outputs.

Is it possible? If so, could bring me any clue on it?

Thanks in advance J

xleyba avatar Mar 29 '19 10:03 xleyba

Hello @xleyba , sorry for the late response. This is actually very easy and we have an example for that case, please read below.

golog supports unlimited number of simultaneously output targets. with AddOutput(io.Writer) method as the _examples/multi-output/main.go does for an os.File. And the good part is that colors are automatically removed from the log line if an output target is not a terminal instance.

kataras avatar Jun 20 '19 21:06 kataras