Maint: package local log levels

This commit is contained in:
Quentin McGaw (desktop)
2021-09-23 17:05:48 +00:00
parent cf95692b93
commit 79f243e98d
5 changed files with 58 additions and 49 deletions

View File

@@ -3,7 +3,6 @@ package openvpn
import (
"testing"
"github.com/qdm12/golibs/logging"
"github.com/stretchr/testify/assert"
)
@@ -12,38 +11,38 @@ func Test_processLogLine(t *testing.T) {
tests := map[string]struct {
s string
filtered string
level logging.Level
level logLevel
}{
"empty string": {"", "", logging.LevelInfo},
"random string": {"asdasqdb", "asdasqdb", logging.LevelInfo},
"empty string": {"", "", levelInfo},
"random string": {"asdasqdb", "asdasqdb", levelInfo},
"openvpn unknown": {
"message",
"message",
logging.LevelInfo},
levelInfo},
"openvpn note": {
"NOTE: message",
"message",
logging.LevelInfo},
levelInfo},
"openvpn warning": {
"WARNING: message",
"message",
logging.LevelWarn},
levelWarn},
"openvpn options error": {
"Options error: message",
"message",
logging.LevelError},
levelError},
"openvpn ignored message": {
"NOTE: UID/GID downgrade will be delayed because of --client, --pull, or --up-delay",
"",
logging.LevelDebug},
levelInfo},
"openvpn success": {
"Initialization Sequence Completed",
"Initialization Sequence Completed",
logging.LevelInfo},
levelInfo},
"openvpn auth failed": {
"AUTH: Received control message: AUTH_FAILED",
"AUTH: Received control message: AUTH_FAILED\n\nYour credentials might be wrong 🤨\n\n",
logging.LevelError},
levelError},
}
for name, tc := range tests {
tc := tc