Add -log-dir option

This commit is contained in:
knqyf263
2017-01-25 08:00:14 +09:00
committed by teppei-fukuda
parent 6c8100e5b6
commit 2e7c34cf9f
9 changed files with 109 additions and 51 deletions

View File

@@ -39,6 +39,7 @@ type ScanCmd struct {
debug bool
configPath string
resultsDir string
logDir string
cacheDBPath string
httpProxy string
askKeyPassword bool
@@ -60,6 +61,7 @@ func (*ScanCmd) Usage() string {
scan
[-config=/path/to/config.toml]
[-results-dir=/path/to/results]
[-log-dir=/path/to/log]
[-cachedb-path=/path/to/cache.db]
[-ssh-external]
[-containers-only]
@@ -85,6 +87,9 @@ func (p *ScanCmd) SetFlags(f *flag.FlagSet) {
defaultResultsDir := filepath.Join(wd, "results")
f.StringVar(&p.resultsDir, "results-dir", defaultResultsDir, "/path/to/results")
defaultLogDir := util.GetDefaultLogDir()
f.StringVar(&p.logDir, "log-dir", defaultLogDir, "/path/to/log")
defaultCacheDBPath := filepath.Join(wd, "cache.db")
f.StringVar(
&p.cacheDBPath,
@@ -193,6 +198,7 @@ func (p *ScanCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{})
Log := util.NewCustomLogger(c.ServerInfo{})
c.Conf.ResultsDir = p.resultsDir
c.Conf.LogDir = p.logDir
c.Conf.CacheDBPath = p.cacheDBPath
c.Conf.SSHExternal = p.sshExternal
c.Conf.HTTPProxy = p.httpProxy