Pull request: all: add us to logs

Merge in DNS/adguard-home from imp-logs to master

Squashed commit of the following:

commit b463825196625f59b19977920f828f57e4b87f0d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue May 18 14:08:24 2021 +0300

    all: add us to logs
This commit is contained in:
Ainar Garipov 2021-05-18 14:20:50 +03:00
parent 397b0ccdf7
commit b2e3e4d088
4 changed files with 11 additions and 3 deletions

View File

@ -23,6 +23,10 @@ and this project adheres to
script ([#2462]). script ([#2462]).
- Support for DHCP `DECLINE` and `RELEASE` message types ([#3053]). - Support for DHCP `DECLINE` and `RELEASE` message types ([#3053]).
### Changed
- Add microseconds to log output.
### Fixed ### Fixed
- Intermittent "Warning: ID mismatch" errors ([#3087]). - Intermittent "Warning: ID mismatch" errors ([#3087]).

2
go.mod
View File

@ -4,7 +4,7 @@ go 1.15
require ( require (
github.com/AdguardTeam/dnsproxy v0.37.4 github.com/AdguardTeam/dnsproxy v0.37.4
github.com/AdguardTeam/golibs v0.4.5 github.com/AdguardTeam/golibs v0.5.0
github.com/AdguardTeam/urlfilter v0.14.5 github.com/AdguardTeam/urlfilter v0.14.5
github.com/NYTimes/gziphandler v1.1.1 github.com/NYTimes/gziphandler v1.1.1
github.com/ameshkov/dnscrypt/v2 v2.1.3 github.com/ameshkov/dnscrypt/v2 v2.1.3

4
go.sum
View File

@ -25,8 +25,8 @@ github.com/AdguardTeam/dnsproxy v0.37.4/go.mod h1:xkJWEuTr550gPDmB9azsciKZzSXjf9
github.com/AdguardTeam/golibs v0.4.0/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4= github.com/AdguardTeam/golibs v0.4.0/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
github.com/AdguardTeam/golibs v0.4.2/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4= github.com/AdguardTeam/golibs v0.4.2/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
github.com/AdguardTeam/golibs v0.4.4/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4= github.com/AdguardTeam/golibs v0.4.4/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
github.com/AdguardTeam/golibs v0.4.5 h1:RRA9ZsmbJEN4OllAx0BcfvSbRBxxpWluJijBYmtp13U= github.com/AdguardTeam/golibs v0.5.0 h1:qwhEKjDrT0UcwDnHrNU2Yg/DLR9b/GsUncnXYW6VzAU=
github.com/AdguardTeam/golibs v0.4.5/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4= github.com/AdguardTeam/golibs v0.5.0/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
github.com/AdguardTeam/gomitmproxy v0.2.0/go.mod h1:Qdv0Mktnzer5zpdpi5rAwixNJzW2FN91LjKJCkVbYGU= github.com/AdguardTeam/gomitmproxy v0.2.0/go.mod h1:Qdv0Mktnzer5zpdpi5rAwixNJzW2FN91LjKJCkVbYGU=
github.com/AdguardTeam/urlfilter v0.14.5 h1:WyF0hg0MwKevsqNPkoaZFH8f5WRi/yuy/7qePtYt5Ts= github.com/AdguardTeam/urlfilter v0.14.5 h1:WyF0hg0MwKevsqNPkoaZFH8f5WRi/yuy/7qePtYt5Ts=
github.com/AdguardTeam/urlfilter v0.14.5/go.mod h1:klx4JbOfc4EaNb5lWLqOwfg+pVcyRukmoJRvO55lL5U= github.com/AdguardTeam/urlfilter v0.14.5/go.mod h1:klx4JbOfc4EaNb5lWLqOwfg+pVcyRukmoJRvO55lL5U=

View File

@ -493,6 +493,10 @@ func configureLogger(args options) {
log.SetLevel(log.DEBUG) log.SetLevel(log.DEBUG)
} }
// Make sure that we see the microseconds in logs, as networking stuff
// can happen pretty quickly.
log.SetFlags(log.LstdFlags | log.Lmicroseconds)
if args.runningAsService && ls.LogFile == "" && runtime.GOOS == "windows" { if args.runningAsService && ls.LogFile == "" && runtime.GOOS == "windows" {
// When running as a Windows service, use eventlog by default if nothing else is configured // When running as a Windows service, use eventlog by default if nothing else is configured
// Otherwise, we'll simply loose the log output // Otherwise, we'll simply loose the log output