mirror of
https://github.com/DNSCrypt/dnscrypt-proxy.git
synced 2025-04-04 21:57:44 +03:00
Update dlog
This commit is contained in:
parent
87c161ab76
commit
9f9318701f
6 changed files with 32 additions and 21 deletions
37
vendor/github.com/jedisct1/dlog/dlog.go
generated
vendored
37
vendor/github.com/jedisct1/dlog/dlog.go
generated
vendored
|
@ -15,16 +15,17 @@ type Severity int32
|
|||
|
||||
type globals struct {
|
||||
sync.Mutex
|
||||
logLevel Severity
|
||||
useSyslog *bool
|
||||
appName string
|
||||
syslogFacility string
|
||||
systemLogger *systemLogger
|
||||
fileName *string
|
||||
outFd *os.File
|
||||
lastMessage string
|
||||
lastOccurrence time.Time
|
||||
occurrences uint64
|
||||
logLevel Severity
|
||||
useSyslog *bool
|
||||
truncateLogFile *bool
|
||||
appName string
|
||||
syslogFacility string
|
||||
systemLogger *systemLogger
|
||||
fileName *string
|
||||
outFd *os.File
|
||||
lastMessage string
|
||||
lastOccurrence time.Time
|
||||
occurrences uint64
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -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
|
||||
}
|
||||
|
|
2
vendor/github.com/jedisct1/dlog/go.mod
generated
vendored
2
vendor/github.com/jedisct1/dlog/go.mod
generated
vendored
|
@ -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
|
||||
)
|
||||
|
|
4
vendor/github.com/jedisct1/dlog/go.sum
generated
vendored
4
vendor/github.com/jedisct1/dlog/go.sum
generated
vendored
|
@ -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=
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue