Skip to content

Commit 0d59ba6

Browse files
committed
Updated logging parameters
- Changed yamlparser to let RUST_LOG override the LoggingLevel going to the yaml parser - Added LOGGING_LEVEL and LOGGING_LEVEL_CONSOLE to comply with environement variable standards while keeping backwards compatibility
1 parent 5d0f9ec commit 0d59ba6

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

common/src/util/log.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import { join as pathJoin } from "path";
66
export { LogLevel } ;
77

88
export const config = {
9-
LogFileName: process.env.LogFileName || "ppaas-common",
10-
LoggingLevel: process.env.LoggingLevel as Logger.LogLevel || "info",
11-
LoggingLevelConsole: process.env.LoggingLevelConsole as Logger.LogLevel || "warn",
9+
LogFileName: process.env.LOG_FILE_NAME || process.env.LogFileName || "ppaas-common",
10+
LoggingLevel: process.env.LOGGING_LEVEL as Logger.LogLevel || process.env.LoggingLevel as Logger.LogLevel || "info",
11+
LoggingLevelConsole: process.env.LOGGING_LEVEL_CONSOLE as Logger.LogLevel || process.env.LoggingLevelConsole as Logger.LogLevel || "warn",
1212
LogFileLocation: process.env.LOG_FILE_LOCATION || "."
1313
};
1414

common/src/yamlparser.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,10 @@ export class YamlParser {
8080
config = new Config(
8181
fileBuffer,
8282
varMap,
83-
typeof logConfig.LoggingLevel === "number" ? undefined : logConfig.LoggingLevel
84-
// TODO: Add version checker
83+
// If RUST_LOG is set use that, otherwise use LoggingLevel
84+
process.env.RUST_LOG || (typeof logConfig.LoggingLevel === "number"
85+
? undefined
86+
: logConfig.LoggingLevel)
8587
);
8688
yamlValid = true;
8789
} catch (error: unknown) {

controller/next.config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ const nextConfig = {
106106
distDir: "dist",
107107
// env: {} // env variables are set at build time, not run time. They are better optimized during the build process
108108
publicRuntimeConfig: { // These are sent to the client and the server and are set at run time
109-
LoggingLevel: process.env.LoggingLevel,
109+
LOGGING_LEVEL: process.env.LOGGING_LEVEL || process.env.LoggingLevel,
110110
APPLICATION_NAME: process.env.APPLICATION_NAME,
111111
SYSTEM_NAME: process.env.SYSTEM_NAME,
112112
FS_SITE: process.env.FS_SITE,
@@ -135,7 +135,7 @@ const nextConfig = {
135135
},
136136
// https://github.com/vercel/next.js/discussions/11493#discussioncomment-14606
137137
env: { // These are sent to the client and the server and are set at build time for static pages
138-
LoggingLevel: process.env.LoggingLevel || "", // Only checks if debug
138+
LOGGING_LEVEL: process.env.LOGGING_LEVEL || process.env.LoggingLevel || "", // Only checks if debug
139139
// @ts-ignore
140140
APPLICATION_NAME: process.env.APPLICATION_NAME,
141141
// @ts-ignore

0 commit comments

Comments
 (0)