From 5c503f04218c6ca4be6beb778946aee57228d056 Mon Sep 17 00:00:00 2001 From: imterah Date: Tue, 18 Mar 2025 20:27:40 -0400 Subject: [PATCH] fix: Make logging options more clear for the backend runtime's backend logs --- .prettierrc | 16 ---------------- backend/api/backendruntime/core.go | 4 ++-- backend/api/backendruntime/struct.go | 2 +- 3 files changed, 3 insertions(+), 19 deletions(-) delete mode 100644 .prettierrc diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index 57562cf..0000000 --- a/.prettierrc +++ /dev/null @@ -1,16 +0,0 @@ -{ - "arrowParens": "avoid", - "bracketSpacing": true, - "htmlWhitespaceSensitivity": "css", - "insertPragma": false, - "jsxSingleQuote": false, - "printWidth": 80, - "proseWrap": "always", - "quoteProps": "as-needed", - "requirePragma": false, - "semi": true, - "singleQuote": false, - "tabWidth": 2, - "trailingComma": "all", - "useTabs": false -} \ No newline at end of file diff --git a/backend/api/backendruntime/core.go b/backend/api/backendruntime/core.go index e06a2a6..eac5934 100644 --- a/backend/api/backendruntime/core.go +++ b/backend/api/backendruntime/core.go @@ -6,10 +6,10 @@ var ( AvailableBackends []*Backend RunningBackends map[uint]*Runtime TempDir string - isDevelopmentMode bool + shouldLog bool ) func init() { RunningBackends = make(map[uint]*Runtime) - isDevelopmentMode = os.Getenv("HERMES_DEVELOPMENT_MODE") != "" + shouldLog = os.Getenv("HERMES_DEVELOPMENT_MODE") != "" || os.Getenv("HERMES_BACKEND_LOGGING_ENABLED") != "" || os.Getenv("HERMES_LOG_LEVEL") == "debug" } diff --git a/backend/api/backendruntime/struct.go b/backend/api/backendruntime/struct.go index 9d057ad..cd30182 100644 --- a/backend/api/backendruntime/struct.go +++ b/backend/api/backendruntime/struct.go @@ -42,7 +42,7 @@ type writeLogger struct { func (writer writeLogger) Write(p []byte) (n int, err error) { logSplit := strings.Split(string(p), "\n") - if isDevelopmentMode { + if shouldLog { for _, logLine := range logSplit { if logLine == "" { continue