diff --git a/examples/main.go b/examples/main.go index d478cf6..8e65906 100644 --- a/examples/main.go +++ b/examples/main.go @@ -18,11 +18,15 @@ func main() { if err != nil { panic(err) } - // Old default way, still works - //dumpExec := dump.Exec(pg.ExecOptions{StreamPrint: false}) - // Note that any io.Writer could be assigned to StreamDestination. For simplicity, I'm just using stdout here. - // But we could write to a unix fifo file, a database, a RabbitMQ queue or whatever + dump.EnableVerbose() + + // Default options + //dumpExec := dump.Exec(pg.ExecOptions{}) + + // Log to stdout + // Note that any io.Writer could be assigned to StreamDestination. I'm just using stdout here for brevity. + // But we could write to a file, a database, a RabbitMQ queue or whatever // We could even write to all of the above using io.MultiWriter(...) dumpExec := dump.Exec(pg.ExecOptions{StreamPrint: true, StreamDestination: os.Stdout}) if dumpExec.Error != nil { diff --git a/utils.go b/utils.go index 74c6620..c359cf4 100644 --- a/utils.go +++ b/utils.go @@ -27,7 +27,7 @@ func streamExecOutput(out io.ReadCloser, options ExecOptions) (string, error) { } if options.StreamPrint { - _, err = fmt.Fprintln(options.StreamDestination, line) + _, err = fmt.Fprint(options.StreamDestination, line) if err != nil { return output, fmt.Errorf("error writing output: %w", err) }