Skip to content

Commit

Permalink
Merge pull request securego#102 from GoASTScanner/bugfix
Browse files Browse the repository at this point in the history
Reduce logging messages a tad
  • Loading branch information
gcmurphy authored Dec 2, 2016
2 parents 465338b + 94ac200 commit c68ed64
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
7 changes: 4 additions & 3 deletions filelist.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package main

import (
"log"
"strings"

"github.com/ryanuber/go-glob"
Expand Down Expand Up @@ -57,11 +56,13 @@ func (f *fileList) Set(path string) error {
func (f fileList) Contains(path string) bool {
for p := range f.patterns {
if glob.Glob(p, path) {
log.Printf("excluding: %s\n", path)
if logger != nil {
logger.Printf("skipping: %s\n", path)
}
return true
}
}
log.Printf("including: %s\n", path)
//log.Printf("including: %s\n", path)
return false
}

Expand Down
13 changes: 7 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,12 @@ func main() {
tools := newUtils()
flag.Var(tools, "tool", "GAS utilities to assist with rule development")

// Setup logging
logger = log.New(os.Stderr, "[gas] ", log.LstdFlags)

// Parse command line arguments
flag.Parse()

// Setup logging
logger = log.New(os.Stderr, "[gas]", log.LstdFlags)

// Ensure at least one file was specified
if flag.NArg() == 0 {

Expand All @@ -195,6 +195,7 @@ func main() {
toAnalyze := getFilesToAnalyze(flag.Args(), excluded)

for _, file := range toAnalyze {
logger.Printf("scanning \"%s\"\n", file)
if err := analyzer.Process(file); err != nil {
logger.Fatal(err)
}
Expand Down Expand Up @@ -226,10 +227,10 @@ func main() {

// getFilesToAnalyze lists all files
func getFilesToAnalyze(paths []string, excluded *fileList) []string {
log.Println("getFilesToAnalyze: start")
//log.Println("getFilesToAnalyze: start")
var toAnalyze []string
for _, path := range paths {
log.Printf("getFilesToAnalyze: processing \"%s\"\n", path)
//log.Printf("getFilesToAnalyze: processing \"%s\"\n", path)
// get the absolute path before doing anything else
path, err := filepath.Abs(path)
if err != nil {
Expand Down Expand Up @@ -257,7 +258,7 @@ func getFilesToAnalyze(paths []string, excluded *fileList) []string {
}
}
}
log.Println("getFilesToAnalyze: end")
//log.Println("getFilesToAnalyze: end")
return toAnalyze
}

Expand Down

0 comments on commit c68ed64

Please sign in to comment.