From 470866ba05d268f29dbf15ef6c25ffe19170d4a4 Mon Sep 17 00:00:00 2001 From: Mayank Thakur <thakurmayank88@gmail.com> Date: Tue, 31 Oct 2023 18:27:40 +0530 Subject: [PATCH 1/8] feat: added debug flag in the SuperTokenConfig in the init() for logging --- supertokens/logger.go | 1 - supertokens/models.go | 1 + supertokens/supertokens.go | 10 ++++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/supertokens/logger.go b/supertokens/logger.go index 7dbcdd1e..210d490a 100644 --- a/supertokens/logger.go +++ b/supertokens/logger.go @@ -28,6 +28,5 @@ func LogDebugMessage(message string) { _, exists := os.LookupEnv("SUPERTOKENS_DEBUG") if exists { logger.Printf(formatMessage(message)) - } } diff --git a/supertokens/models.go b/supertokens/models.go index 4a625735..92172620 100644 --- a/supertokens/models.go +++ b/supertokens/models.go @@ -46,6 +46,7 @@ type TypeInput struct { AppInfo AppInfo RecipeList []Recipe Telemetry *bool + Debug *bool OnSuperTokensAPIError func(err error, req *http.Request, res http.ResponseWriter) } diff --git a/supertokens/supertokens.go b/supertokens/supertokens.go index d1e7b017..0789bf84 100644 --- a/supertokens/supertokens.go +++ b/supertokens/supertokens.go @@ -20,6 +20,7 @@ import ( "errors" "flag" "net/http" + "os" "reflect" "strconv" "strings" @@ -35,6 +36,7 @@ type superTokens struct { RecipeModules []RecipeModule OnSuperTokensAPIError func(err error, req *http.Request, res http.ResponseWriter) Telemetry *bool + Debug *bool } // this will be set to true if this is used in a test app environment @@ -54,6 +56,14 @@ func supertokensInit(config TypeInput) error { superTokens.OnSuperTokensAPIError = config.OnSuperTokensAPIError } + superTokens.Debug = config.Debug + if superTokens.Debug != nil && *superTokens.Debug { + err := os.Setenv("SUPERTOKENS_DEBUG", "1") + if err != nil { + return err + } + } + LogDebugMessage("Started SuperTokens with debug logging (supertokens.Init called)") appInfoJsonString, _ := json.Marshal(config.AppInfo) From 1003a57ee9cc7ad5c2a6829386fe200931262636 Mon Sep 17 00:00:00 2001 From: Mayank Thakur <thakurmayank88@gmail.com> Date: Wed, 1 Nov 2023 11:43:49 +0530 Subject: [PATCH 2/8] feat: added debug flag in the SuperTokenConfig in the init() for logging --- recipe/session/logger_test.go | 136 ++++++++++++++++++++++++++++++++++ supertokens/logger.go | 4 +- supertokens/supertokens.go | 2 +- 3 files changed, 139 insertions(+), 3 deletions(-) create mode 100644 recipe/session/logger_test.go diff --git a/recipe/session/logger_test.go b/recipe/session/logger_test.go new file mode 100644 index 00000000..458f1126 --- /dev/null +++ b/recipe/session/logger_test.go @@ -0,0 +1,136 @@ +package session + +import ( + "bytes" + "log" + "os" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/supertokens/supertokens-golang/supertokens" + "github.com/supertokens/supertokens-golang/test/unittesting" +) + +func TestLogDebugMessageWhenDebugTrue(t *testing.T) { + var logMessage = "test log message" + var buf bytes.Buffer + + debug := true + supertokens.Logger = log.New(&buf, "", 0) + + configValue := supertokens.TypeInput{ + Supertokens: &supertokens.ConnectionInfo{ + ConnectionURI: "http://localhost:8080", + }, + AppInfo: supertokens.AppInfo{ + AppName: "SuperTokens", + APIDomain: "api.supertokens.io", + WebsiteDomain: "supertokens.io", + }, + RecipeList: []supertokens.Recipe{ + Init(nil), + }, + Debug: &debug, + } + BeforeEach() + + unittesting.StartUpST("localhost", "8080") + + defer AfterEach() + + err := supertokens.Init(configValue) + + if err != nil { + t.Error(err.Error()) + } + + supertokensInstance, err := supertokens.GetInstanceOrThrowError() + + if err != nil { + t.Error(err.Error()) + } + + supertokens.LogDebugMessage(logMessage) + assert.Equal(t, &debug, supertokensInstance.Debug) + assert.Contains(t, buf.String(), logMessage, "checking log message in logs") +} + +func TestLogDebugMessageWhenDebugFalse(t *testing.T) { + var logMessage = "test log message" + var buf bytes.Buffer + + debug := false + supertokens.Logger = log.New(&buf, "", 0) + + configValue := supertokens.TypeInput{ + Supertokens: &supertokens.ConnectionInfo{ + ConnectionURI: "http://localhost:8080", + }, + AppInfo: supertokens.AppInfo{ + AppName: "SuperTokens", + APIDomain: "api.supertokens.io", + WebsiteDomain: "supertokens.io", + }, + RecipeList: []supertokens.Recipe{ + Init(nil), + }, + Debug: &debug, + } + BeforeEach() + + unittesting.StartUpST("localhost", "8080") + + defer AfterEach() + + err := supertokens.Init(configValue) + + if err != nil { + t.Error(err.Error()) + } + + supertokensInstance, err := supertokens.GetInstanceOrThrowError() + + if err != nil { + t.Error(err.Error()) + } + + supertokens.LogDebugMessage(logMessage) + assert.Equal(t, &debug, supertokensInstance.Debug) + assert.NotContains(t, buf.String(), logMessage, "checking log message in logs") +} + +func TestLogDebugMessageWithEnvVar(t *testing.T) { + var logMessage = "test log message" + var buf bytes.Buffer + + supertokens.Logger = log.New(&buf, "", 0) + os.Setenv("SUPERTOKENS_DEBUG", "1") + + configValue := supertokens.TypeInput{ + Supertokens: &supertokens.ConnectionInfo{ + ConnectionURI: "http://localhost:8080", + }, + AppInfo: supertokens.AppInfo{ + AppName: "SuperTokens", + APIDomain: "api.supertokens.io", + WebsiteDomain: "supertokens.io", + }, + RecipeList: []supertokens.Recipe{ + Init(nil), + }, + } + BeforeEach() + + unittesting.StartUpST("localhost", "8080") + + defer AfterEach() + + err := supertokens.Init(configValue) + + if err != nil { + t.Error(err.Error()) + } + + supertokens.LogDebugMessage(logMessage) + assert.Contains(t, buf.String(), logMessage, "checking log message in logs") +} diff --git a/supertokens/logger.go b/supertokens/logger.go index 210d490a..7731f966 100644 --- a/supertokens/logger.go +++ b/supertokens/logger.go @@ -16,7 +16,7 @@ const supertokens_namespace = "com.supertokens" */ var ( - logger = log.New(os.Stdout, supertokens_namespace, 0) + Logger = log.New(os.Stdout, supertokens_namespace, 0) ) func formatMessage(message string) string { @@ -27,6 +27,6 @@ func formatMessage(message string) string { func LogDebugMessage(message string) { _, exists := os.LookupEnv("SUPERTOKENS_DEBUG") if exists { - logger.Printf(formatMessage(message)) + Logger.Printf(formatMessage(message)) } } diff --git a/supertokens/supertokens.go b/supertokens/supertokens.go index 0789bf84..0196e0e5 100644 --- a/supertokens/supertokens.go +++ b/supertokens/supertokens.go @@ -57,7 +57,7 @@ func supertokensInit(config TypeInput) error { } superTokens.Debug = config.Debug - if superTokens.Debug != nil && *superTokens.Debug { + if superTokens.Debug != nil && *superTokens.Debug == true { err := os.Setenv("SUPERTOKENS_DEBUG", "1") if err != nil { return err From 758edbcf1345d511568910406523e8f3a2fe13a3 Mon Sep 17 00:00:00 2001 From: Mayank Thakur <thakurmayank88@gmail.com> Date: Wed, 1 Nov 2023 12:07:19 +0530 Subject: [PATCH 3/8] updated changelog and bumped version --- CHANGELOG.md | 5 +++++ supertokens/constants.go | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dd41c2d7..9eb550b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [unreleased] + +## [0.14.1] - 2023-11-1 + +- Adds `debug` flag to the `TypeInput`. If set to `true`, debug logs will be printed. + ## [0.14.0] - 2023-09-11 ### Added diff --git a/supertokens/constants.go b/supertokens/constants.go index adcff424..e07f6bfc 100644 --- a/supertokens/constants.go +++ b/supertokens/constants.go @@ -21,7 +21,7 @@ const ( ) // VERSION current version of the lib -const VERSION = "0.14.0" +const VERSION = "0.14.1" var ( cdiSupported = []string{"3.0"} From 66089db8c8165b55465453dd5aeaf2ad8d663123 Mon Sep 17 00:00:00 2001 From: Mayank Thakur <thakurmayank88@gmail.com> Date: Wed, 1 Nov 2023 14:40:46 +0530 Subject: [PATCH 4/8] fix: used superTokenInstance to check if debug is enabled, instead of the ENV variable --- recipe/session/logger_test.go | 64 +++++++++++++++++++++++++++++----- recipe/session/testingUtils.go | 7 ++++ supertokens/logger.go | 2 +- supertokens/models.go | 2 +- supertokens/supertokens.go | 10 ++---- 5 files changed, 66 insertions(+), 19 deletions(-) diff --git a/recipe/session/logger_test.go b/recipe/session/logger_test.go index 458f1126..f3b7873f 100644 --- a/recipe/session/logger_test.go +++ b/recipe/session/logger_test.go @@ -11,12 +11,13 @@ import ( "github.com/supertokens/supertokens-golang/test/unittesting" ) +// Added the logger tests here because supertokens/logger_test.go causes cyclic import errors due to imports in test/unittesting/testingUtils.go + func TestLogDebugMessageWhenDebugTrue(t *testing.T) { var logMessage = "test log message" var buf bytes.Buffer - debug := true - supertokens.Logger = log.New(&buf, "", 0) + supertokens.Logger = log.New(&buf, "test", 0) configValue := supertokens.TypeInput{ Supertokens: &supertokens.ConnectionInfo{ @@ -30,13 +31,14 @@ func TestLogDebugMessageWhenDebugTrue(t *testing.T) { RecipeList: []supertokens.Recipe{ Init(nil), }, - Debug: &debug, + Debug: true, } BeforeEach() unittesting.StartUpST("localhost", "8080") defer AfterEach() + defer resetLogger() err := supertokens.Init(configValue) @@ -51,7 +53,7 @@ func TestLogDebugMessageWhenDebugTrue(t *testing.T) { } supertokens.LogDebugMessage(logMessage) - assert.Equal(t, &debug, supertokensInstance.Debug) + assert.Equal(t, true, supertokensInstance.Debug) assert.Contains(t, buf.String(), logMessage, "checking log message in logs") } @@ -59,8 +61,51 @@ func TestLogDebugMessageWhenDebugFalse(t *testing.T) { var logMessage = "test log message" var buf bytes.Buffer - debug := false - supertokens.Logger = log.New(&buf, "", 0) + supertokens.Logger = log.New(&buf, "test", 0) + + configValue := supertokens.TypeInput{ + Supertokens: &supertokens.ConnectionInfo{ + ConnectionURI: "http://localhost:8080", + }, + AppInfo: supertokens.AppInfo{ + AppName: "SuperTokens", + APIDomain: "api.supertokens.io", + WebsiteDomain: "supertokens.io", + }, + RecipeList: []supertokens.Recipe{ + Init(nil), + }, + Debug: false, + } + BeforeEach() + + unittesting.StartUpST("localhost", "8080") + + defer AfterEach() + defer resetLogger() + + err := supertokens.Init(configValue) + + if err != nil { + t.Error(err.Error()) + } + + supertokensInstance, err := supertokens.GetInstanceOrThrowError() + + if err != nil { + t.Error(err.Error()) + } + + supertokens.LogDebugMessage(logMessage) + assert.Equal(t, false, supertokensInstance.Debug) + assert.NotContains(t, buf.String(), logMessage, "checking log message in logs") +} + +func TestLogDebugMessageWhenDebugNotSet(t *testing.T) { + var logMessage = "test log message" + var buf bytes.Buffer + + supertokens.Logger = log.New(&buf, "test", 0) configValue := supertokens.TypeInput{ Supertokens: &supertokens.ConnectionInfo{ @@ -74,13 +119,13 @@ func TestLogDebugMessageWhenDebugFalse(t *testing.T) { RecipeList: []supertokens.Recipe{ Init(nil), }, - Debug: &debug, } BeforeEach() unittesting.StartUpST("localhost", "8080") defer AfterEach() + defer resetLogger() err := supertokens.Init(configValue) @@ -95,7 +140,7 @@ func TestLogDebugMessageWhenDebugFalse(t *testing.T) { } supertokens.LogDebugMessage(logMessage) - assert.Equal(t, &debug, supertokensInstance.Debug) + assert.Equal(t, false, supertokensInstance.Debug) assert.NotContains(t, buf.String(), logMessage, "checking log message in logs") } @@ -103,7 +148,7 @@ func TestLogDebugMessageWithEnvVar(t *testing.T) { var logMessage = "test log message" var buf bytes.Buffer - supertokens.Logger = log.New(&buf, "", 0) + supertokens.Logger = log.New(&buf, "test", 0) os.Setenv("SUPERTOKENS_DEBUG", "1") configValue := supertokens.TypeInput{ @@ -124,6 +169,7 @@ func TestLogDebugMessageWithEnvVar(t *testing.T) { unittesting.StartUpST("localhost", "8080") defer AfterEach() + defer resetLogger() err := supertokens.Init(configValue) diff --git a/recipe/session/testingUtils.go b/recipe/session/testingUtils.go index 43834591..668195da 100644 --- a/recipe/session/testingUtils.go +++ b/recipe/session/testingUtils.go @@ -16,7 +16,9 @@ package session import ( + "log" "net/http" + "os" "github.com/supertokens/supertokens-golang/supertokens" "github.com/supertokens/supertokens-golang/test/unittesting" @@ -48,6 +50,11 @@ func AfterEach() { unittesting.CleanST() } +func resetLogger() { + supertokens.Logger = log.New(os.Stdout, "com.supertokens", 0) + os.Unsetenv("SUPERTOKENS_DEBUG") +} + type fakeRes struct{} func (f fakeRes) Header() http.Header { diff --git a/supertokens/logger.go b/supertokens/logger.go index 7731f966..9b9b90c1 100644 --- a/supertokens/logger.go +++ b/supertokens/logger.go @@ -26,7 +26,7 @@ func formatMessage(message string) string { func LogDebugMessage(message string) { _, exists := os.LookupEnv("SUPERTOKENS_DEBUG") - if exists { + if exists || superTokensInstance.Debug == true { Logger.Printf(formatMessage(message)) } } diff --git a/supertokens/models.go b/supertokens/models.go index 92172620..3c842d45 100644 --- a/supertokens/models.go +++ b/supertokens/models.go @@ -46,7 +46,7 @@ type TypeInput struct { AppInfo AppInfo RecipeList []Recipe Telemetry *bool - Debug *bool + Debug bool OnSuperTokensAPIError func(err error, req *http.Request, res http.ResponseWriter) } diff --git a/supertokens/supertokens.go b/supertokens/supertokens.go index 0196e0e5..7b4f3b39 100644 --- a/supertokens/supertokens.go +++ b/supertokens/supertokens.go @@ -20,7 +20,6 @@ import ( "errors" "flag" "net/http" - "os" "reflect" "strconv" "strings" @@ -36,7 +35,7 @@ type superTokens struct { RecipeModules []RecipeModule OnSuperTokensAPIError func(err error, req *http.Request, res http.ResponseWriter) Telemetry *bool - Debug *bool + Debug bool } // this will be set to true if this is used in a test app environment @@ -57,12 +56,7 @@ func supertokensInit(config TypeInput) error { } superTokens.Debug = config.Debug - if superTokens.Debug != nil && *superTokens.Debug == true { - err := os.Setenv("SUPERTOKENS_DEBUG", "1") - if err != nil { - return err - } - } + superTokensInstance = superTokens LogDebugMessage("Started SuperTokens with debug logging (supertokens.Init called)") From 7e36bfbe2da2e0e1df5bf69939d06fc76f508f36 Mon Sep 17 00:00:00 2001 From: rishabhpoddar <rishabh.poddar@gmail.com> Date: Wed, 1 Nov 2023 19:20:57 +0530 Subject: [PATCH 5/8] moves function --- recipe/session/logger_test.go | 5 +++++ recipe/session/testingUtils.go | 7 ------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/recipe/session/logger_test.go b/recipe/session/logger_test.go index f3b7873f..5f916536 100644 --- a/recipe/session/logger_test.go +++ b/recipe/session/logger_test.go @@ -13,6 +13,11 @@ import ( // Added the logger tests here because supertokens/logger_test.go causes cyclic import errors due to imports in test/unittesting/testingUtils.go +func resetLogger() { + supertokens.Logger = log.New(os.Stdout, "com.supertokens", 0) + os.Unsetenv("SUPERTOKENS_DEBUG") +} + func TestLogDebugMessageWhenDebugTrue(t *testing.T) { var logMessage = "test log message" var buf bytes.Buffer diff --git a/recipe/session/testingUtils.go b/recipe/session/testingUtils.go index 668195da..43834591 100644 --- a/recipe/session/testingUtils.go +++ b/recipe/session/testingUtils.go @@ -16,9 +16,7 @@ package session import ( - "log" "net/http" - "os" "github.com/supertokens/supertokens-golang/supertokens" "github.com/supertokens/supertokens-golang/test/unittesting" @@ -50,11 +48,6 @@ func AfterEach() { unittesting.CleanST() } -func resetLogger() { - supertokens.Logger = log.New(os.Stdout, "com.supertokens", 0) - os.Unsetenv("SUPERTOKENS_DEBUG") -} - type fakeRes struct{} func (f fakeRes) Header() http.Header { From 62b28f9f29184300b606fe8f574c8667fa7251cb Mon Sep 17 00:00:00 2001 From: rishabhpoddar <rishabh.poddar@gmail.com> Date: Wed, 1 Nov 2023 19:25:31 +0530 Subject: [PATCH 6/8] fixes changelog --- CHANGELOG.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 33babf0a..b6a39fd6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,9 +56,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - This is optional (so you are not required to update your overrides). Returning undefined means that the header is not set. - Handle AWS Public URLs (ending with `.amazonaws.com`) separately while extracting TLDs for SameSite attribute. - Return `500` status instead of panic when `supertokens.Middleware` is used without initializing the SDK. -## [0.14.1] - 2023-11-1 - -- Handle AWS Public URLs (ending with `.amazonaws.com`) separately while extracting TLDs for SameSite attribute. - Updates fiber adaptor package in the fiber example. ## [0.14.0] - 2023-09-11 From 22974dd308200472aed5c88fcedf8579f9554ace Mon Sep 17 00:00:00 2001 From: Mayank Thakur <thakurmayank88@gmail.com> Date: Wed, 1 Nov 2023 19:49:06 +0530 Subject: [PATCH 7/8] fix: store debugEnabled in logger.go instead of supertokens struct --- recipe/session/logger_test.go | 21 --------------------- supertokens/logger.go | 5 +++-- supertokens/supertokens.go | 4 +--- 3 files changed, 4 insertions(+), 26 deletions(-) diff --git a/recipe/session/logger_test.go b/recipe/session/logger_test.go index 5f916536..0364ae8d 100644 --- a/recipe/session/logger_test.go +++ b/recipe/session/logger_test.go @@ -51,14 +51,7 @@ func TestLogDebugMessageWhenDebugTrue(t *testing.T) { t.Error(err.Error()) } - supertokensInstance, err := supertokens.GetInstanceOrThrowError() - - if err != nil { - t.Error(err.Error()) - } - supertokens.LogDebugMessage(logMessage) - assert.Equal(t, true, supertokensInstance.Debug) assert.Contains(t, buf.String(), logMessage, "checking log message in logs") } @@ -95,14 +88,7 @@ func TestLogDebugMessageWhenDebugFalse(t *testing.T) { t.Error(err.Error()) } - supertokensInstance, err := supertokens.GetInstanceOrThrowError() - - if err != nil { - t.Error(err.Error()) - } - supertokens.LogDebugMessage(logMessage) - assert.Equal(t, false, supertokensInstance.Debug) assert.NotContains(t, buf.String(), logMessage, "checking log message in logs") } @@ -138,14 +124,7 @@ func TestLogDebugMessageWhenDebugNotSet(t *testing.T) { t.Error(err.Error()) } - supertokensInstance, err := supertokens.GetInstanceOrThrowError() - - if err != nil { - t.Error(err.Error()) - } - supertokens.LogDebugMessage(logMessage) - assert.Equal(t, false, supertokensInstance.Debug) assert.NotContains(t, buf.String(), logMessage, "checking log message in logs") } diff --git a/supertokens/logger.go b/supertokens/logger.go index 9b9b90c1..92724114 100644 --- a/supertokens/logger.go +++ b/supertokens/logger.go @@ -16,7 +16,8 @@ const supertokens_namespace = "com.supertokens" */ var ( - Logger = log.New(os.Stdout, supertokens_namespace, 0) + Logger = log.New(os.Stdout, supertokens_namespace, 0) + debugEnabled = false ) func formatMessage(message string) string { @@ -26,7 +27,7 @@ func formatMessage(message string) string { func LogDebugMessage(message string) { _, exists := os.LookupEnv("SUPERTOKENS_DEBUG") - if exists || superTokensInstance.Debug == true { + if exists || debugEnabled == true { Logger.Printf(formatMessage(message)) } } diff --git a/supertokens/supertokens.go b/supertokens/supertokens.go index 7b4f3b39..e8e72351 100644 --- a/supertokens/supertokens.go +++ b/supertokens/supertokens.go @@ -35,7 +35,6 @@ type superTokens struct { RecipeModules []RecipeModule OnSuperTokensAPIError func(err error, req *http.Request, res http.ResponseWriter) Telemetry *bool - Debug bool } // this will be set to true if this is used in a test app environment @@ -55,8 +54,7 @@ func supertokensInit(config TypeInput) error { superTokens.OnSuperTokensAPIError = config.OnSuperTokensAPIError } - superTokens.Debug = config.Debug - superTokensInstance = superTokens + debugEnabled = config.Debug LogDebugMessage("Started SuperTokens with debug logging (supertokens.Init called)") From 54e351692c013a48f2441b4995b895fe93c3007e Mon Sep 17 00:00:00 2001 From: Mayank Thakur <thakurmayank88@gmail.com> Date: Wed, 1 Nov 2023 23:21:10 +0530 Subject: [PATCH 8/8] fix: reset debugEnabled to false in tests --- recipe/session/logger_test.go | 1 + supertokens/logger.go | 4 ++-- supertokens/supertokens.go | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/recipe/session/logger_test.go b/recipe/session/logger_test.go index 0364ae8d..4fe4c8bc 100644 --- a/recipe/session/logger_test.go +++ b/recipe/session/logger_test.go @@ -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) { diff --git a/supertokens/logger.go b/supertokens/logger.go index 92724114..2a364d80 100644 --- a/supertokens/logger.go +++ b/supertokens/logger.go @@ -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 { @@ -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)) } } diff --git a/supertokens/supertokens.go b/supertokens/supertokens.go index e8e72351..dcb3ed7e 100644 --- a/supertokens/supertokens.go +++ b/supertokens/supertokens.go @@ -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)")