On Oct 28, 2013 3:02 PM, "Han-Wen Nienhuys" <han...@google.com> wrote:
> I have an application that I would like to ship as a -Hwindowsgui app, so it doesn't start console window.
>
> In this configuration, is there a way to log the panic stacktraces to some file, and if yes how do I do this?
yes. first get the log file's handle (File.Fd()), then use windows syscall SetStdHandle (in kernel32) to set STD_ERROR_HANDLE
(-12) to that handle.
.. get the log file's handle (File.Fd()), then use windows syscall SetStdHandle (in kernel32) to set STD_ERROR_HANDLE
(-12) to that handle.
Fair enough. This will work with panic(), because it uses GetStdHandle before every write. But that trick will not work with fmt.Fprintf(os.Stderr, ...).
Alex
now here is the correct program:
Actually, I'm thinking if this feature belongs to the runtime (or runtime/debug) package.
I will propose it after Go 1.2 is released.