Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release 1.5.8 #232

Merged
merged 23 commits into from
Nov 25, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
1f6ad09
update AAAA response to be inline with rfc4074
dovholuknf Nov 24, 2020
5e668fb
bump version and update release notes
dovholuknf Nov 24, 2020
2ff2f8b
[ci skip] committing updated installer file
ziti-ci Nov 24, 2020
2522963
remove setup-msbuild@v1 - seems like it's not necessary?
dovholuknf Nov 24, 2020
a6f1499
Merge branch 'release-next' of github.com:openziti/desktop-edge-win i…
dovholuknf Nov 24, 2020
8a7a54c
remove setup-msbuild@v1 - seems like it's not necessary?
dovholuknf Nov 24, 2020
49f421e
[ci skip] committing updated installer file
ziti-ci Nov 24, 2020
b1192c6
fixes issue #234 - use consistent time formatter for log messages
dovholuknf Nov 24, 2020
bd9e824
Merge pull request #236 from openziti/issue-234-log-using-utc
dovholuknf Nov 24, 2020
7d29590
update log formats in UI and monitor service and update service forma…
dovholuknf Nov 24, 2020
abef83c
Merge pull request #237 from openziti/issue-234-log-using-utc
dovholuknf Nov 24, 2020
65d2511
add missing import that was removed by mistake somehow
dovholuknf Nov 24, 2020
a780eba
update tunneler/c sdk and use new functionality to format the logs. m…
dovholuknf Nov 24, 2020
d94e45e
update release notes too
dovholuknf Nov 24, 2020
7d224f6
Merge pull request #238 from openziti/issue-234-log-using-utc
dovholuknf Nov 24, 2020
b41cd5f
[ci skip] committing updated version related files
ziti-ci Nov 24, 2020
55a93e6
fix multiwriter not writing to a file
dovholuknf Nov 25, 2020
f7b8b13
fixes #239 - services wrongly marked duplicated. update build and rel…
dovholuknf Nov 25, 2020
1e6e139
how'd you get up there?
dovholuknf Nov 25, 2020
70e47f9
formatting fix
dovholuknf Nov 25, 2020
2493dec
Merge pull request #240 from openziti/issue-239-fix-dupe-detection
dovholuknf Nov 25, 2020
0729967
updated release notes too
dovholuknf Nov 25, 2020
d21b0f3
Merge pull request #241 from openziti/issue-239-fix-dupe-detection
dovholuknf Nov 25, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ZitiUpdateService/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<!--default to look for updates once every ten minutes-->
<add key="Version" value="release"/>
<add key="ClientSettingsProvider.ServiceUri" value=""/>
<add key="UseBetaReleases" value="false"/>
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
Expand Down
4 changes: 2 additions & 2 deletions service/cziti/windns.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ package cziti
import (
"bytes"
"fmt"
"github.com/michaelquigley/pfxlog"
"github.com/openziti/desktop-edge-win/service/ziti-tunnel/util/logging"
"net"
"os"
"os/exec"
"strings"
)

var log = pfxlog.Logger()
var log = logging.Logger()

func ResetDNS() {
log.Info("resetting DNS server addresses")
Expand Down
2 changes: 1 addition & 1 deletion service/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869 // indirect
github.com/lestrrat-go/file-rotatelogs v2.3.0+incompatible
github.com/lestrrat-go/strftime v1.0.1 // indirect
github.com/michaelquigley/pfxlog v0.0.0-20190813191113-2be43bd0dccc
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b
github.com/miekg/dns v1.1.29
github.com/openziti/foundation v0.14.17
github.com/openziti/sdk-golang v0.14.12
Expand Down
4 changes: 2 additions & 2 deletions service/ziti-tunnel/util/detect-ip-changes.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package util

import (
"github.com/michaelquigley/pfxlog"
"github.com/openziti/desktop-edge-win/service/ziti-tunnel/util/logging"
"syscall"
"unsafe"

Expand All @@ -32,7 +32,7 @@ var (
procWSACreateEvent = modws2_32.NewProc("WSACreateEvent")
procNotifyAddrChange = modiphlpapi.NewProc("NotifyAddrChange")
procNotifyRouteChange = modiphlpapi.NewProc("NotifyRouteChange")
log = pfxlog.Logger()
log = logging.Logger()
)

func OnIPChange(callback func()) {
Expand Down
97 changes: 80 additions & 17 deletions service/ziti-tunnel/util/logging/loghelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,34 +18,48 @@
package logging

import (
"fmt"
rotatelogs "github.com/lestrrat-go/file-rotatelogs"
"github.com/michaelquigley/pfxlog"
"github.com/openziti/desktop-edge-win/service/cziti"
"github.com/sirupsen/logrus"
"golang.org/x/sys/windows/svc/debug"
"io"
"os"
"strings"
"syscall"
"time"

"github.com/openziti/desktop-edge-win/service/ziti-tunnel/config"
)

var Elog debug.Log
var logger *logrus.Entry
var logger = logrus.New()
var loggerInitialized = false
var tf = "2006-01-02-030405.999"
var tfl = len(tf)


func init() {
/*
* https://github.com/sirupsen/logrus/issues/496
*/
handle := syscall.Handle(os.Stdout.Fd())
kernel32DLL := syscall.NewLazyDLL("kernel32.dll")
setConsoleModeProc := kernel32DLL.NewProc("SetConsoleMode")
setConsoleModeProc.Call(uintptr(handle), 0x0001|0x0002|0x0004)

func Logger() *logrus.Entry {
if logger == nil {
logger = pfxlog.Logger()
f := &dateFormatter{
timeFormat: tf,
}
return logger
logger.SetFormatter(f)
}

var loggerInitialized = false
func Logger() *logrus.Logger {
return logger
}

func InitLogger(level string) {
l, _ := ParseLevel(level)
logrus.SetLevel(l)
logger.SetLevel(l)

rl, _ := rotatelogs.New(config.LogFile() + ".%Y%m%d%H%M.log",
rotatelogs.WithRotationTime(24 * time.Hour),
Expand All @@ -55,7 +69,6 @@ func InitLogger(level string) {
multiWriter := io.MultiWriter(rl, os.Stdout)

logrus.SetOutput(multiWriter)
logrus.SetFormatter(pfxlog.NewFormatter())
if !loggerInitialized {
logger.Infof("============================================================================")
logger.Infof("Logger initialization")
Expand All @@ -66,12 +79,6 @@ func InitLogger(level string) {
}
}

func SetLogLevel(goLevel logrus.Level, cLevel int) {
logrus.Infof("Setting logger levels to %s", goLevel)
logrus.SetLevel(goLevel)
cziti.SetLogLevel(cLevel)
}

func ParseLevel(lvl string) (logrus.Level, int) {
switch strings.ToLower(lvl) {
case "panic":
Expand All @@ -94,4 +101,60 @@ func ParseLevel(lvl string) (logrus.Level, int) {
logrus.Warnf("level not recognized: [%s]. Using Info", lvl)
return logrus.InfoLevel, 3
}
}
}

type dateFormatter struct {
timeFormat string
}

func (f *dateFormatter) Format(entry *logrus.Entry) ([]byte, error) {
var level string
switch entry.Level {
case logrus.PanicLevel:
level = panicColor
case logrus.FatalLevel:
level = fatalColor
case logrus.ErrorLevel:
level = errorColor
case logrus.WarnLevel:
level = warnColor
case logrus.InfoLevel:
level = infoColor
case logrus.DebugLevel:
level = debugColor
case logrus.TraceLevel:
level = traceColor
}

now := f.padDateWithZeros(time.Now().UTC())
return []byte(fmt.Sprintf("[%sz] %s\t%s\n",
now,
level,
entry.Message),
),
nil
}

var zeros = "000"
func (f *dateFormatter) padDateWithZeros(t time.Time) string {
d := t.Format(f.timeFormat)
l := len(d)
if l == tfl {
return d
}

toPad := tfl - l
if toPad == 4 {
return d + ".000"
} else {
return d + zeros[:tfl-l]
}
}

var panicColor = ansi.Red + "PANIC" + ansi.DefaultFG
var fatalColor = ansi.Red + "FATAL" + ansi.DefaultFG
var errorColor = ansi.Red + "ERROR" + ansi.DefaultFG
var warnColor = ansi.Yellow + " WARN" + ansi.DefaultFG
var infoColor = ansi.White + " INFO" + ansi.DefaultFG
var debugColor = ansi.Blue + "DEBUG" + ansi.DefaultFG
var traceColor = ansi.LightBlack + "TRACE" + ansi.DefaultFG