move log wrapper library outside into hmage/golibs/log

This commit is contained in:
Eugene Bujak 2018-12-29 19:12:22 +03:00
parent 568784b992
commit 368e2d1ebd
22 changed files with 22 additions and 76 deletions

2
app.go
View File

@ -12,8 +12,8 @@ import (
"syscall"
"time"
"github.com/AdguardTeam/AdGuardHome/log"
"github.com/gobuffalo/packr"
"github.com/hmage/golibs/log"
"golang.org/x/crypto/ssh/terminal"
)

View File

@ -9,7 +9,7 @@ import (
"github.com/AdguardTeam/AdGuardHome/dhcpd"
"github.com/AdguardTeam/AdGuardHome/dnsfilter"
"github.com/AdguardTeam/AdGuardHome/dnsforward"
"github.com/AdguardTeam/AdGuardHome/log"
"github.com/hmage/golibs/log"
"gopkg.in/yaml.v2"
)

View File

@ -12,8 +12,8 @@ import (
"time"
"github.com/AdguardTeam/AdGuardHome/dnsforward"
"github.com/AdguardTeam/AdGuardHome/log"
"github.com/AdguardTeam/dnsproxy/upstream"
"github.com/hmage/golibs/log"
"github.com/miekg/dns"
"gopkg.in/asaskevich/govalidator.v4"
)

View File

@ -10,7 +10,7 @@ import (
"time"
"github.com/AdguardTeam/AdGuardHome/dhcpd"
"github.com/AdguardTeam/AdGuardHome/log"
"github.com/hmage/golibs/log"
"github.com/joomcode/errorx"
)

View File

@ -9,7 +9,7 @@ import (
"os"
"time"
"github.com/AdguardTeam/AdGuardHome/log"
"github.com/hmage/golibs/log"
"github.com/krolaw/dhcp4"
)

View File

@ -6,7 +6,7 @@ import (
"net"
"time"
"github.com/AdguardTeam/AdGuardHome/log"
"github.com/hmage/golibs/log"
"github.com/krolaw/dhcp4"
)

View File

@ -5,7 +5,7 @@ import (
"net"
"strings"
"github.com/AdguardTeam/AdGuardHome/log"
"github.com/hmage/golibs/log"
"github.com/joomcode/errorx"
)

View File

@ -8,7 +8,7 @@ import (
"time"
"github.com/AdguardTeam/AdGuardHome/dhcpd"
"github.com/AdguardTeam/AdGuardHome/log"
"github.com/hmage/golibs/log"
"github.com/krolaw/dhcp4"
)

2
dns.go
View File

@ -6,8 +6,8 @@ import (
"github.com/AdguardTeam/AdGuardHome/dnsfilter"
"github.com/AdguardTeam/AdGuardHome/dnsforward"
"github.com/AdguardTeam/AdGuardHome/log"
"github.com/AdguardTeam/dnsproxy/upstream"
"github.com/hmage/golibs/log"
"github.com/joomcode/errorx"
)

View File

@ -16,8 +16,8 @@ import (
"sync/atomic"
"time"
"github.com/AdguardTeam/AdGuardHome/log"
"github.com/bluele/gcache"
"github.com/hmage/golibs/log"
"golang.org/x/net/publicsuffix"
)

View File

@ -17,7 +17,7 @@ import (
"os"
"runtime"
"github.com/AdguardTeam/AdGuardHome/log"
"github.com/hmage/golibs/log"
"github.com/shirou/gopsutil/process"
"go.uber.org/goleak"
)

View File

@ -9,9 +9,9 @@ import (
"time"
"github.com/AdguardTeam/AdGuardHome/dnsfilter"
"github.com/AdguardTeam/AdGuardHome/log"
"github.com/AdguardTeam/dnsproxy/proxy"
"github.com/AdguardTeam/dnsproxy/upstream"
"github.com/hmage/golibs/log"
"github.com/joomcode/errorx"
"github.com/miekg/dns"
)

View File

@ -11,7 +11,7 @@ import (
"time"
"github.com/AdguardTeam/AdGuardHome/dnsfilter"
"github.com/AdguardTeam/AdGuardHome/log"
"github.com/hmage/golibs/log"
"github.com/miekg/dns"
)

View File

@ -9,8 +9,8 @@ import (
"sync"
"time"
"github.com/AdguardTeam/AdGuardHome/log"
"github.com/go-test/deep"
"github.com/hmage/golibs/log"
)
var (

View File

@ -13,8 +13,8 @@ import (
"sync"
"time"
"github.com/AdguardTeam/AdGuardHome/log"
"github.com/bluele/gcache"
"github.com/hmage/golibs/log"
"github.com/miekg/dns"
)

View File

@ -8,7 +8,7 @@ import (
"time"
"github.com/AdguardTeam/AdGuardHome/dnsfilter"
"github.com/AdguardTeam/AdGuardHome/log"
"github.com/hmage/golibs/log"
)
var (

View File

@ -12,7 +12,7 @@ import (
"time"
"github.com/AdguardTeam/AdGuardHome/dnsfilter"
"github.com/AdguardTeam/AdGuardHome/log"
"github.com/hmage/golibs/log"
)
var (

1
go.mod
View File

@ -10,6 +10,7 @@ require (
github.com/go-ole/go-ole v1.2.1 // indirect
github.com/go-test/deep v1.0.1
github.com/gobuffalo/packr v1.19.0
github.com/hmage/golibs v0.0.0-20181229160906-c8491df0bfc4
github.com/jedisct1/go-dnsstamps v0.0.0-20180418170050-1e4999280f86
github.com/joomcode/errorx v0.1.0
github.com/krolaw/dhcp4 v0.0.0-20180925202202-7cead472c414

2
go.sum
View File

@ -32,6 +32,8 @@ github.com/gobuffalo/packd v0.0.0-20181031195726-c82734870264 h1:roWyi0eEdiFreSq
github.com/gobuffalo/packd v0.0.0-20181031195726-c82734870264/go.mod h1:Yf2toFaISlyQrr5TfO3h6DB9pl9mZRmyvBGQb/aQ/pI=
github.com/gobuffalo/packr v1.19.0 h1:3UDmBDxesCOPF8iZdMDBBWKfkBoYujIMIZePnobqIUI=
github.com/gobuffalo/packr v1.19.0/go.mod h1:MstrNkfCQhd5o+Ct4IJ0skWlxN8emOq8DsoT1G98VIU=
github.com/hmage/golibs v0.0.0-20181229160906-c8491df0bfc4 h1:FMAReGTEDNr4AdbScv/PqzjMQUpkkVHiF/t8sDHQQVQ=
github.com/hmage/golibs v0.0.0-20181229160906-c8491df0bfc4/go.mod h1:H6Ev6svFxUVPFThxLtdnFfcE9e3GWufpfmcVFpqV6HM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/jedisct1/go-dnsstamps v0.0.0-20180418170050-1e4999280f86 h1:Olj4M6T1omUfx7yTTcnhLf4xo6gYMmRHSJIfeA1NZy0=
github.com/jedisct1/go-dnsstamps v0.0.0-20180418170050-1e4999280f86/go.mod h1:j/ONpSHHmPgDwmFKXg9vhQvIjADe/ft1X4a3TVOmp9g=

View File

@ -6,7 +6,7 @@ import (
"net/http"
"strings"
"github.com/AdguardTeam/AdGuardHome/log"
"github.com/hmage/golibs/log"
)
// --------------------

View File

@ -1,57 +0,0 @@
// Wrapper for standard library log, with the only difference is that it has extra function Tracef() and optional verbose flag to enable output from that.
package log
import (
"fmt"
"log"
"os"
"path"
"runtime"
"strings"
)
var Verbose = false
// Print calls Output to print to the standard logger.
// Arguments are handled in the manner of fmt.Print.
func Print(v ...interface{}) {
log.Print(v...)
}
// Printf calls Output to print to the standard logger.
// Arguments are handled in the manner of fmt.Printf.
func Printf(format string, v ...interface{}) {
log.Printf(format, v...)
}
// Println calls Output to print to the standard logger.
// Arguments are handled in the manner of fmt.Println.
func Println(v ...interface{}) {
log.Println(v...)
}
// Fatal is equivalent to Print() followed by a call to os.Exit(1).
func Fatal(v ...interface{}) {
log.Fatal(v...)
}
// Fatalf is equivalent to Printf() followed by a call to os.Exit(1).
func Fatalf(format string, v ...interface{}) {
log.Fatalf(format, v...)
}
func Tracef(format string, v ...interface{}) {
if Verbose {
pc := make([]uintptr, 10) // at least 1 entry needed
runtime.Callers(2, pc)
f := runtime.FuncForPC(pc[0])
var buf strings.Builder
buf.WriteString(fmt.Sprintf("%s(): ", path.Base(f.Name())))
text := fmt.Sprintf(format, v...)
buf.WriteString(text)
if len(text) == 0 || text[len(text)-1] != '\n' {
buf.WriteRune('\n')
}
fmt.Fprint(os.Stderr, buf.String())
}
}

View File

@ -6,7 +6,7 @@ import (
"os"
"path/filepath"
"github.com/AdguardTeam/AdGuardHome/log"
"github.com/hmage/golibs/log"
"gopkg.in/yaml.v2"
)