Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mosajjal committed Jan 15, 2023
1 parent 5677d18 commit 8caa2f3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion internal/output/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
type fileConfig struct {
FileOutputType uint `long:"fileoutputtype" ini-name:"fileoutputtype" env:"DNSMONSTER_FILEOUTPUTTYPE" default:"0" description:"What should be written to file. options:\n;\t0: Disable Output\n;\t1: Enable Output without any filters\n;\t2: Enable Output and apply skipdomains logic\n;\t3: Enable Output and apply allowdomains logic\n;\t4: Enable Output and apply both skip and allow domains logic" choice:"0" choice:"1" choice:"2" choice:"3" choice:"4"`
FileOutputPath flags.Filename `long:"fileoutputpath" ini-name:"fileoutputpath" env:"DNSMONSTER_FILEOUTPUTPATH" default:"" description:"Path to output folder. Used if fileOutputType is not none"`
FileOutputRotateCron string `long:"fileoutputrotatecron" ini-name:"fileOutputrotatecron" env:"DNSMONSTER_FILEOUTPUTROTATECRON" default:"0 0 0 * *" description:"Interval to rotate the file in cron format"`
FileOutputRotateCron string `long:"fileoutputrotatecron" ini-name:"fileOutputrotatecron" env:"DNSMONSTER_FILEOUTPUTROTATECRON" default:"0 0 * * *" description:"Interval to rotate the file in cron format"`
FileOutputRotateCount uint `long:"fileoutputrotatecount" ini-name:"fileoutputrotatecount" env:"DNSMONSTER_FILEOUTPUTROTATECOUNT" default:"4" description:"Number of files to keep. 0 to disable rotation"`
FileOutputFormat string `long:"fileoutputformat" ini-name:"fileoutputformat" env:"DNSMONSTER_FILEOUTPUTFORMAT" default:"json" description:"Output format for file. options:json,csv, csv_no_header, gotemplate. note that the csv splits the datetime format into multiple fields" choice:"json" choice:"csv" choice:"csv_no_header" choice:"gotemplate"`
FileOutputGoTemplate string `long:"fileoutputgotemplate" ini-name:"fileoutputgotemplate" env:"DNSMONSTER_FILEOUTPUTGOTEMPLATE" default:"{{.}}" description:"Go Template to format the output as needed"`
Expand Down Expand Up @@ -116,6 +116,7 @@ func (config fileConfig) Output(ctx context.Context) {
case <-ctx.Done():
config.writer.Close()
log.Debug("exitting out of file output") //todo:remove
return
}
}
}
4 changes: 2 additions & 2 deletions internal/output/stdout.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ func (stdConfig stdoutConfig) stdoutOutputWorker(ctx context.Context) {
continue
}
stdoutSentToOutput.Inc(1)
fmt.Fprint(os.Stdout, stdConfig.outputMarshaller.Marshal(data))
fmt.Fprint(os.Stdout, []byte("\n"))
fmt.Fprint(os.Stdout, string(stdConfig.outputMarshaller.Marshal(data)))
fmt.Fprint(os.Stdout, "\n")
}
case <-ctx.Done():
log.Debug("exitting out of stdout output worker") //todo:remove
Expand Down

0 comments on commit 8caa2f3

Please sign in to comment.