Skip to content

Commit

Permalink
Finished logging improvments. Closes #6.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dids committed Aug 31, 2018
1 parent ab27f34 commit 4c0d5fc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Clobber is command-line application for building [Clover](https://sourceforge.ne
- [x] Ability to build Clover on any machine (as long as the requirements are met)
- [x] Target a specific Clover version/revision
- [x] See less/more build output (`--verbose`, `--quiet` flags etc.)
- [ ] Better logging (log to file, use colors to signify log type etc.)
- [x] Better logging (log to file, use colors to signify log type etc.)
- [x] Support for additional drivers (AptioFixPkg, ApfsSupportPkg etc.)
- [ ] Additional customization options (select to include/exclude drivers etc.)

Expand Down
14 changes: 9 additions & 5 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ var RootCmd = &cobra.Command{
Spinner.Start()
}

log.Debug("Verbose mode is enabled")
log.Debug("Target Clover revision:", Revision)
if args != nil && len(args) > 0 {
log.Debug("Building with arguments:", args)
Expand Down Expand Up @@ -255,6 +254,7 @@ var RootCmd = &cobra.Command{

// Stop the spinner
if !Verbose && !Quiet {
log.Debug(executionResult)
Spinner.FinalMSG = executionResult
Spinner.Stop()
} else {
Expand All @@ -281,21 +281,25 @@ func customInit() {
// Create a new log formatter
formatter := new(prefixed.TextFormatter)

// Change the log format based on the current verbosity
// Enable showing a proper timestamp
formatter.FullTimestamp = true

/*// Change the log format based on the current verbosity
if Verbose {
// Enable showing a proper timestamp
formatter.FullTimestamp = true
} else {
// Hide timestamp when running in non-verbose mode
formatter.DisableTimestamp = true
}
}*/

// Assign our logger to use the custom formatter
if Verbose && !Quiet {
log.Formatter = formatter
/*if Verbose && !Quiet {
log.Formatter = formatter
} else if !Verbose && !Quiet {
log.Formatter = new(ClobberLogFormatter)
}
}*/

// Ensure the log file folder exists
mkdirErr := os.MkdirAll(util.GetLogsPath(), 0755)
Expand Down

0 comments on commit 4c0d5fc

Please sign in to comment.