I am new to Go. Currently, I’m writing a tool that will capture all stdout outputs, and consolidate them into a new file.
In order to do so, I am using io.Multiwriter. However, my problem lies in trying to capture all of the stdout output across packages and subpackages.
Currently, my approach is to create a new package which has an exclusive role of all logging. Whenever one of the other packages/subpackages have some output string, I will send the string to the logging package, while will then multiwrite to the log and to stdout.
Does this sound reasonable? If so, what should the general logging package API look like? Also, what is good way to pass a string for output/logging across to the logging package?
Thank you!