quick fix for when logging.file.enabled is false
This commit is contained in:
parent
42a47dbcb7
commit
ca66217be8
@ -196,15 +196,17 @@ export default {
|
||||
};
|
||||
|
||||
// Configure GadgetLog for this package
|
||||
const logFileOptions = {
|
||||
basePath: yamlConfig.logging?.file?.path
|
||||
GadgetLog.consoleEnabled = yamlConfig.logging?.console?.enabled === true;
|
||||
if (yamlConfig.logging?.file?.enabled === true) {
|
||||
const logFileOptions = {
|
||||
basePath: yamlConfig.logging.file.path
|
||||
? resolvePath(yamlConfig.logging.file.path)
|
||||
: path.join(INSTALL_DIR, "logs"),
|
||||
name: yamlConfig.logging?.file?.name || "gadget-code",
|
||||
maxWritesPerFile: yamlConfig.logging?.file?.maxWritesPerFile || 10000,
|
||||
maxFiles: yamlConfig.logging?.file?.maxFiles || 10,
|
||||
};
|
||||
const defaultLogFile = new GadgetLogFile(logFileOptions);
|
||||
defaultLogFile.open();
|
||||
GadgetLog.consoleEnabled = yamlConfig.logging?.console?.enabled === true;
|
||||
GadgetLog.defaultFile = yamlConfig.logging?.file?.enabled === true ? defaultLogFile : undefined;
|
||||
name: yamlConfig.logging.file.name || "gadget-code",
|
||||
maxWritesPerFile: yamlConfig.logging.file.maxWritesPerFile || 10000,
|
||||
maxFiles: yamlConfig.logging.file.maxFiles || 10,
|
||||
};
|
||||
const defaultLogFile = new GadgetLogFile(logFileOptions);
|
||||
defaultLogFile.open();
|
||||
GadgetLog.defaultFile = defaultLogFile;
|
||||
}
|
||||
|
||||
@ -76,17 +76,19 @@ export default {
|
||||
};
|
||||
|
||||
// Configure GadgetLog for this package
|
||||
const logFileOptions = {
|
||||
basePath: yamlConfig.logging?.file?.path
|
||||
GadgetLog.consoleEnabled = yamlConfig.logging?.console?.enabled === true;
|
||||
if (yamlConfig.logging?.file?.enabled === true) {
|
||||
const logFileOptions = {
|
||||
basePath: yamlConfig.logging.file.path
|
||||
? resolvePath(yamlConfig.logging.file.path)
|
||||
: path.join(INSTALL_DIR, "logs"),
|
||||
name: yamlConfig.logging?.file?.name || "gadget-drone",
|
||||
maxWritesPerFile: yamlConfig.logging?.file?.maxWritesPerFile || 10000,
|
||||
maxFiles: yamlConfig.logging?.file?.maxFiles || 10,
|
||||
};
|
||||
const defaultLogFile = new GadgetLogFile(logFileOptions);
|
||||
defaultLogFile.open();
|
||||
GadgetLog.consoleEnabled = yamlConfig.logging?.console?.enabled === true;
|
||||
GadgetLog.defaultFile = yamlConfig.logging?.file?.enabled === true ? defaultLogFile : undefined;
|
||||
name: yamlConfig.logging.file.name || "gadget-drone",
|
||||
maxWritesPerFile: yamlConfig.logging.file.maxWritesPerFile || 10000,
|
||||
maxFiles: yamlConfig.logging.file.maxFiles || 10,
|
||||
};
|
||||
const defaultLogFile = new GadgetLogFile(logFileOptions);
|
||||
defaultLogFile.open();
|
||||
GadgetLog.defaultFile = defaultLogFile;
|
||||
}
|
||||
|
||||
/* eslint-enable no-process-env */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user