Minor (complete) refactor #38

Merged
sam merged 20 commits from small-things into master 2022-07-26 00:32:32 +00:00
2 changed files with 8 additions and 2 deletions
Showing only changes of commit b35f1b5c67 - Show all commits

View file

@ -36,6 +36,9 @@ func ParseMiscArgs(args []string, opts *Options) error {
case strings.HasPrefix(arg, "+"):
// Dig-style +queries
err = ParseDig(strings.ToLower(arg[1:]), opts)
if err != nil {
return err
}
default:
//else, assume it's a name
opts.Query, err = idna.ToASCII(arg)

View file

@ -92,12 +92,15 @@ func (l *Logger) Printer(level Level, s string) error {
defer l.Mu.Unlock()
l.buf = l.buf[:0]
l.FormatHeader(&l.buf, now, line, level)
err := l.FormatHeader(&l.buf, now, line, level)
if err != nil {
return err
}
l.buf = append(l.buf, s...)
if len(s) == 0 || s[len(s)-1] != '\n' {
l.buf = append(l.buf, '\n')
}
_, err := l.Out.Write(l.buf)
_, err = l.Out.Write(l.buf)
return err
}