Switched to SimpleFormatter (so that output on Windows would be readable)

This commit is contained in:
Stanley Shyiko
2016-07-22 13:23:36 -07:00
parent f69ab8ed6a
commit d7df2eebe3
2 changed files with 15 additions and 0 deletions
+1
View File
@@ -312,6 +312,7 @@ func installFromBin(source string, target string) (err error) {
}
func installFromExe(source string, target string) error {
log.Info("Unpacking " + source + " to " + target)
// using ShellExecute instead of exec.Command so user could decide whether to trust the installer when UAC is active
return w32.ShellExecuteAndWait(w32.HWND(0), "open", source, "/s INSTALLDIR=\"" + target +
"\" STATIC=1 AUTO_UPDATE=0 WEB_JAVA=0 WEB_ANALYTICS=0 REBOOT=0", "", 3)
+14
View File
@@ -11,16 +11,30 @@ import (
"sort"
"io/ioutil"
"strings"
"bytes"
)
var version string
var rootCmd *cobra.Command
func init() {
log.SetFormatter(&SimpleFormatter{})
// todo: make it configurable through the command line
log.SetLevel(log.InfoLevel)
}
type SimpleFormatter struct {}
func (f *SimpleFormatter) Format(entry *log.Entry) ([]byte, error) {
b := &bytes.Buffer{}
fmt.Fprintf(b, "%s ", entry.Message)
for k, v := range entry.Data {
fmt.Fprintf(b, "%s=%+v ", k, v)
}
b.WriteByte('\n')
return b.Bytes(), nil
}
func main() {
rootCmd = &cobra.Command{
Use: "jabba",