Update dlog
This commit is contained in:
parent
87c161ab76
commit
9f9318701f
2
go.mod
2
go.mod
|
@ -13,7 +13,7 @@ require (
|
|||
github.com/hashicorp/go-immutable-radix v1.2.0
|
||||
github.com/hashicorp/golang-lru v0.5.4
|
||||
github.com/hectane/go-acl v0.0.0-20190604041725-da78bae5fc95
|
||||
github.com/jedisct1/dlog v0.0.0-20190909160351-692385b00b84
|
||||
github.com/jedisct1/dlog v0.0.0-20200608182644-a0fe4302a941
|
||||
github.com/jedisct1/go-clocksmith v0.0.0-20190707124905-73e087c7979c
|
||||
github.com/jedisct1/go-dnsstamps v0.0.0-20200205175031-8109eec6ec46
|
||||
github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e
|
||||
|
|
6
go.sum
6
go.sum
|
@ -32,8 +32,8 @@ github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+l
|
|||
github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
|
||||
github.com/hectane/go-acl v0.0.0-20190604041725-da78bae5fc95 h1:S4qyfL2sEm5Budr4KVMyEniCy+PbS55651I/a+Kn/NQ=
|
||||
github.com/hectane/go-acl v0.0.0-20190604041725-da78bae5fc95/go.mod h1:QiyDdbZLaJ/mZP4Zwc9g2QsfaEA4o7XvvgZegSci5/E=
|
||||
github.com/jedisct1/dlog v0.0.0-20190909160351-692385b00b84 h1:7Q8p5MNx7fMvIRFirdWQpqPEtoSMyskdyOjdi6x4pLc=
|
||||
github.com/jedisct1/dlog v0.0.0-20190909160351-692385b00b84/go.mod h1:YXh1b5j+lwirsCCtTJW19DrbpaL9/5UzwNjI78Cvrg8=
|
||||
github.com/jedisct1/dlog v0.0.0-20200608182644-a0fe4302a941 h1:BL7Wr9TaQB9lzUh2q3DQwDVNMQuB9uzmHjLhOxUWZxE=
|
||||
github.com/jedisct1/dlog v0.0.0-20200608182644-a0fe4302a941/go.mod h1:qlw2+W23d6vMLRF2E7PLeQrk903Fp7hZRSeYQQMcKW8=
|
||||
github.com/jedisct1/go-clocksmith v0.0.0-20190707124905-73e087c7979c h1:a/NQUT7AXkEfhaZ+nb7Uzqijo1Qc7C7SZpRrv+6UQDA=
|
||||
github.com/jedisct1/go-clocksmith v0.0.0-20190707124905-73e087c7979c/go.mod h1:SAINchklztk2jcLWJ4bpNF4KnwDUSUTX+cJbspWC2Rw=
|
||||
github.com/jedisct1/go-dnsstamps v0.0.0-20200205175031-8109eec6ec46 h1:EgxCa7UN+QWlNe3EzxtpszkkpuG3ctC3aCIfUE/gqjM=
|
||||
|
@ -82,11 +82,9 @@ golang.org/x/sys v0.0.0-20190529164535-6a60838ec259/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||
golang.org/x/sys v0.0.0-20190909082730-f460065e899a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191029155521-f43be2a4598c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884=
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980 h1:OjiUf46hAmXblsZdnoSXsEUSKU8r1UEzcL5RVZ4gO9Y=
|
||||
golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
|
|
|
@ -17,6 +17,7 @@ type globals struct {
|
|||
sync.Mutex
|
||||
logLevel Severity
|
||||
useSyslog *bool
|
||||
truncateLogFile *bool
|
||||
appName string
|
||||
syslogFacility string
|
||||
systemLogger *systemLogger
|
||||
|
@ -174,13 +175,19 @@ func UseSyslog(value bool) {
|
|||
_globals.Unlock()
|
||||
}
|
||||
|
||||
func TruncateLogFile(value bool) {
|
||||
_globals.Lock()
|
||||
_globals.truncateLogFile = &value
|
||||
_globals.Unlock()
|
||||
}
|
||||
|
||||
func UseLogFile(fileName string) {
|
||||
_globals.Lock()
|
||||
_globals.fileName = &fileName
|
||||
_globals.Unlock()
|
||||
}
|
||||
|
||||
func GetFileDescriptor() (*os.File) {
|
||||
func GetFileDescriptor() *os.File {
|
||||
_globals.Lock()
|
||||
createFileDescriptor()
|
||||
_globals.Unlock()
|
||||
|
@ -195,7 +202,13 @@ func SetFileDescriptor(fd *os.File) {
|
|||
|
||||
func createFileDescriptor() {
|
||||
if _globals.fileName != nil && len(*_globals.fileName) > 0 && _globals.outFd == nil {
|
||||
outFd, err := os.OpenFile(*_globals.fileName, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0644)
|
||||
mode := os.O_WRONLY | os.O_CREATE
|
||||
if _globals.truncateLogFile != nil && *_globals.truncateLogFile {
|
||||
mode |= os.O_TRUNC
|
||||
} else {
|
||||
mode |= os.O_APPEND
|
||||
}
|
||||
outFd, err := os.OpenFile(*_globals.fileName, mode, 0644)
|
||||
if err == nil {
|
||||
_globals.outFd = outFd
|
||||
}
|
||||
|
|
|
@ -4,5 +4,5 @@ go 1.13
|
|||
|
||||
require (
|
||||
github.com/hashicorp/go-syslog v1.0.0
|
||||
golang.org/x/sys v0.0.0-20190909082730-f460065e899a
|
||||
golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980
|
||||
)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
github.com/hashicorp/go-syslog v1.0.0 h1:KaodqZuhUoZereWVIYmpUgZysurB1kBLX2j0MwMrUAE=
|
||||
github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
|
||||
golang.org/x/sys v0.0.0-20190909082730-f460065e899a h1:mIzbOulag9/gXacgxKlFVwpCOWSfBT3/pDyyCwGA9as=
|
||||
golang.org/x/sys v0.0.0-20190909082730-f460065e899a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980 h1:OjiUf46hAmXblsZdnoSXsEUSKU8r1UEzcL5RVZ4gO9Y=
|
||||
golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
|
|
|
@ -30,7 +30,7 @@ github.com/hashicorp/golang-lru/simplelru
|
|||
# github.com/hectane/go-acl v0.0.0-20190604041725-da78bae5fc95
|
||||
github.com/hectane/go-acl
|
||||
github.com/hectane/go-acl/api
|
||||
# github.com/jedisct1/dlog v0.0.0-20190909160351-692385b00b84
|
||||
# github.com/jedisct1/dlog v0.0.0-20200608182644-a0fe4302a941
|
||||
github.com/jedisct1/dlog
|
||||
# github.com/jedisct1/go-clocksmith v0.0.0-20190707124905-73e087c7979c
|
||||
github.com/jedisct1/go-clocksmith
|
||||
|
|
Loading…
Reference in New Issue