create log later in processing (closes #177)

This commit is contained in:
Alex Goodman 2019-03-16 11:10:47 -04:00
parent a1e0f08408
commit 031d9b914e
No known key found for this signature in database
GPG Key ID: 743640FAA11698A1
4 changed files with 12 additions and 2 deletions

View File

@ -30,6 +30,8 @@ func doAnalyzeCmd(cmd *cobra.Command, args []string) {
utils.Exit(1)
}
initLogging()
runtime.Run(runtime.Options{
ImageId: userImage,
ExportFile: exportFile,

View File

@ -22,6 +22,8 @@ func init() {
func doBuildCmd(cmd *cobra.Command, args []string) {
defer utils.Cleanup()
initLogging()
runtime.Run(runtime.Options{
BuildArgs: args,
ExportFile: exportFile,

View File

@ -40,7 +40,6 @@ func Execute() {
func init() {
cobra.OnInitialize(initConfig)
cobra.OnInitialize(initLogging)
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.dive.yaml, ~/.config/dive.yaml, or $XDG_CONFIG_HOME/dive.yaml)")
rootCmd.PersistentFlags().BoolP("version", "v", false, "display version number")

View File

@ -1,5 +1,9 @@
package filetree
import (
"github.com/sirupsen/logrus"
)
type TreeCacheKey struct {
bottomTreeStart, bottomTreeStop, topTreeStart, topTreeStop int
}
@ -24,7 +28,10 @@ func (cache *TreeCache) Get(bottomTreeStart, bottomTreeStop, topTreeStart, topTr
func (cache *TreeCache) buildTree(key TreeCacheKey) *FileTree {
newTree := StackTreeRange(cache.refTrees, key.bottomTreeStart, key.bottomTreeStop)
for idx := key.topTreeStart; idx <= key.topTreeStop; idx++ {
newTree.CompareAndMark(cache.refTrees[idx])
err := newTree.CompareAndMark(cache.refTrees[idx])
if err != nil {
logrus.Errorf("unable to build tree: %+v", err)
}
}
return newTree
}