Skip to content

Commit

Permalink
fix: set log level at the beginning of the forge command
Browse files Browse the repository at this point in the history
previously the log level was set within the generate function, as a result, the generator resolver used the wrong log level
  • Loading branch information
ColinEberhardt committed Mar 31, 2023
1 parent cbd9524 commit 9a8958b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/forge/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const {
configToCommanderOptions,
generatorOptionsPrefix,
} = require("../generatorOptions/generatorOptions");
const log = require("../common/log");

const forgeCommand = function (program) {
const command = program
Expand Down Expand Up @@ -36,7 +37,9 @@ const forgeCommand = function (program) {
"1"
)
.allowUnknownOption()
.action(async (schema, generatorPathOrUrl) => {
.action(async (schema, generatorPathOrUrl, options) => {
log.setLogLevel(options.logLevel);

const generatorPath = generatorResolver.getGenerator(generatorPathOrUrl);
const configFile = path.join(generatorPath, "config.json");

Expand Down
1 change: 0 additions & 1 deletion src/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ function getFilesInFolders(basePath, partialPath = "") {
// IMPORTANT: This function is used in the generators, so be careful when modifying!
// See issue https://github.com/ScottLogic/openapi-forge/issues/158
async function generate(schemaPathOrUrl, generatorPathOrUrl, options) {
log.setLogLevel(options.logLevel);
log.logTitle();
let exception = null;
let numberOfDiscoveredModels = 0;
Expand Down

0 comments on commit 9a8958b

Please sign in to comment.