Skip to content

Commit

Permalink
fix: reset debugEnabled to false in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
IamMayankThakur committed Nov 1, 2023
1 parent 22974dd commit 54e3516
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions recipe/session/logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
func resetLogger() {
supertokens.Logger = log.New(os.Stdout, "com.supertokens", 0)
os.Unsetenv("SUPERTOKENS_DEBUG")
supertokens.DebugEnabled = false
}

func TestLogDebugMessageWhenDebugTrue(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions supertokens/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const supertokens_namespace = "com.supertokens"

var (
Logger = log.New(os.Stdout, supertokens_namespace, 0)
debugEnabled = false
DebugEnabled = false
)

func formatMessage(message string) string {
Expand All @@ -27,7 +27,7 @@ func formatMessage(message string) string {

func LogDebugMessage(message string) {
_, exists := os.LookupEnv("SUPERTOKENS_DEBUG")
if exists || debugEnabled == true {
if exists || DebugEnabled == true {
Logger.Printf(formatMessage(message))
}
}
2 changes: 1 addition & 1 deletion supertokens/supertokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func supertokensInit(config TypeInput) error {
superTokens.OnSuperTokensAPIError = config.OnSuperTokensAPIError
}

debugEnabled = config.Debug
DebugEnabled = config.Debug

LogDebugMessage("Started SuperTokens with debug logging (supertokens.Init called)")

Expand Down

0 comments on commit 54e3516

Please sign in to comment.