I'm new to Go and trying to find a solution to the following problem.
- The goal is to write all logs to a file.
- package main imports package A.
- In package main, in the main method, logging is setup to write to a file
- package A has an init function. In the init function of A, there is a log line - log.Fatal("I am package A").
- Since main package imports A, A's init function is first called (even before we get a chance to setup the logs to write to a file).
How to resolve this so the log "I am package A" gets written to a file?