fix: Make logging options more clear for the backend runtime's backend logs
This commit is contained in:
parent
959718163e
commit
5c503f0421
3 changed files with 3 additions and 19 deletions
16
.prettierrc
16
.prettierrc
|
@ -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
|
|
||||||
}
|
|
|
@ -6,10 +6,10 @@ var (
|
||||||
AvailableBackends []*Backend
|
AvailableBackends []*Backend
|
||||||
RunningBackends map[uint]*Runtime
|
RunningBackends map[uint]*Runtime
|
||||||
TempDir string
|
TempDir string
|
||||||
isDevelopmentMode bool
|
shouldLog bool
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
RunningBackends = make(map[uint]*Runtime)
|
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"
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ type writeLogger struct {
|
||||||
func (writer writeLogger) Write(p []byte) (n int, err error) {
|
func (writer writeLogger) Write(p []byte) (n int, err error) {
|
||||||
logSplit := strings.Split(string(p), "\n")
|
logSplit := strings.Split(string(p), "\n")
|
||||||
|
|
||||||
if isDevelopmentMode {
|
if shouldLog {
|
||||||
for _, logLine := range logSplit {
|
for _, logLine := range logSplit {
|
||||||
if logLine == "" {
|
if logLine == "" {
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue