Skip to content

πŸŽ₯ Make videos programmatically with React

info

Jonny Burgerc6ed741fa0d7
diff --git a/packages/cli/src/bundle.ts b/packages/cli/src/bundle.ts
index f024e930d3..893389ee51 100644
--- a/packages/cli/src/bundle.ts
+++ b/packages/cli/src/bundle.ts
@@ -104,7 +104,10 @@ export const bundleCommand = async (
// Handle floating point inaccuracies
if (bundling.progress < 0.99999) {
if (updatesDontOverwrite) {
- Log.info(`Bundling ${Math.round(bundling.progress * 100)}%`);
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ `Bundling ${Math.round(bundling.progress * 100)}%`,
+ );
}
}
diff --git a/packages/cli/src/code-frame.ts b/packages/cli/src/code-frame.ts
index aa3ce62567..fa9797ec98 100644
--- a/packages/cli/src/code-frame.ts
+++ b/packages/cli/src/code-frame.ts
@@ -19,23 +19,28 @@ const makeFileName = (firstFrame: SymbolicatedStackFrame) => {
.join(':');
};
-const printCodeFrame = (frame: SymbolicatedStackFrame) => {
+const printCodeFrame = (frame: SymbolicatedStackFrame, logLevel: LogLevel) => {
if (!frame.originalScriptCode) {
return;
}
- Log.info();
+ Log.infoAdvanced({indent: false, logLevel});
const longestLineNumber = Math.max(
...frame.originalScriptCode.map((script) => script.lineNumber),
).toString().length;
- Log.info('at', chalk.underline(makeFileName(frame)));
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ 'at',
+ chalk.underline(makeFileName(frame)),
+ );
const alignLeftAmount = Math.min(
...frame.originalScriptCode.map(
(c) => c.content.length - c.content.trimStart().length,
),
);
- Log.info(
+ Log.infoAdvanced(
+ {indent: false, logLevel},
`${frame.originalScriptCode
.map((c) => {
const left = String(c.lineNumber).padStart(longestLineNumber, ' ');
@@ -50,13 +55,14 @@ const printCodeFrame = (frame: SymbolicatedStackFrame) => {
);
};
-const logLine = (frame: SymbolicatedStackFrame) => {
+const logLine = (frame: SymbolicatedStackFrame, logLevel: LogLevel) => {
const fileName = makeFileName(frame);
if (!fileName) {
return;
}
- Log.info(
+ Log.infoAdvanced(
+ {indent: false, logLevel},
chalk.gray(
['at', frame.originalFunctionName, `${chalk.blueBright(`(${fileName})`)}`]
.filter(truthy)
@@ -83,8 +89,8 @@ export const printCodeFrameAndStack = (
chalk.bgRed(chalk.white(` ${err.name} `)),
err.message,
);
- printCodeFrame(firstFrame);
- Log.info();
+ printCodeFrame(firstFrame, logLevel);
+ Log.infoAdvanced({indent: false, logLevel});
for (const frame of err.symbolicatedStackFrames) {
if (frame === firstFrame) {
continue;
@@ -94,9 +100,9 @@ export const printCodeFrameAndStack = (
!frame.originalFileName?.includes('node_modules') &&
!frame.originalFileName?.startsWith('webpack/');
if (isUserCode) {
- printCodeFrame(frame);
+ printCodeFrame(frame, logLevel);
} else {
- logLine(frame);
+ logLine(frame, logLevel);
}
}
@@ -117,9 +123,9 @@ export const printCodeFrameAndStack = (
.includes('delayRender');
if (showCodeFrame) {
- printCodeFrame(frame);
+ printCodeFrame(frame, logLevel);
} else {
- logLine(frame);
+ logLine(frame, logLevel);
}
}
}
diff --git a/packages/cli/src/compositions.ts b/packages/cli/src/compositions.ts
index 4cfc118b69..8401715580 100644
--- a/packages/cli/src/compositions.ts
+++ b/packages/cli/src/compositions.ts
@@ -124,5 +124,5 @@ export const listCompositionsCommand = async (
}).value,
});
- printCompositions(compositions);
+ printCompositions(compositions, logLevel);
};
diff --git a/packages/cli/src/get-env.ts b/packages/cli/src/get-env.ts
index 1a507f21df..170adec149 100644
--- a/packages/cli/src/get-env.ts
+++ b/packages/cli/src/get-env.ts
@@ -50,10 +50,16 @@ const watchEnvFile = ({
Log.warn({indent: false, logLevel}, `${envFile} was deleted.`);
} else if (type === 'changed') {
await updateFile();
- Log.info(chalk.blueBright(`Updated env file ${envFile}`));
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ chalk.blueBright(`Updated env file ${envFile}`),
+ );
} else if (type === 'created') {
await updateFile();
- Log.info(chalk.blueBright(`Created env file ${envFile}`));
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ chalk.blueBright(`Created env file ${envFile}`),
+ );
}
} catch (err) {
Log.error(
diff --git a/packages/cli/src/get-input-props.ts b/packages/cli/src/get-input-props.ts
index 16146ca767..f4bcdf1810 100644
--- a/packages/cli/src/get-input-props.ts
+++ b/packages/cli/src/get-input-props.ts
@@ -22,7 +22,10 @@ export const getInputProps = (
fs.watchFile(jsonFile, {interval: 100}, () => {
try {
onUpdate(JSON.parse(fs.readFileSync(jsonFile, 'utf-8')));
- Log.info(`Updated input props from ${jsonFile}.`);
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ `Updated input props from ${jsonFile}.`,
+ );
} catch (err) {
Log.error(
{indent: false, logLevel},
@@ -42,7 +45,11 @@ export const getInputProps = (
'You passed --props but it was neither valid JSON nor a file path to a valid JSON file. Provided value: ' +
parsedCli.props,
);
- Log.info('Got the following value:', parsedCli.props);
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ 'Got the following value:',
+ parsedCli.props,
+ );
Log.error(
{indent: false, logLevel},
'Check that your input is parseable using `JSON.parse` and try again.',
diff --git a/packages/cli/src/gpu.ts b/packages/cli/src/gpu.ts
index 58e33b3afc..8075e2d43d 100644
--- a/packages/cli/src/gpu.ts
+++ b/packages/cli/src/gpu.ts
@@ -47,7 +47,10 @@ export const gpuCommand = async (remotionRoot: string, logLevel: LogLevel) => {
timeoutInMilliseconds: puppeteerTimeout,
});
for (const {feature, status} of statuses) {
- Log.info(`${feature}: ${colorStatus(status)}`);
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ `${feature}: ${colorStatus(status)}`,
+ );
}
};
diff --git a/packages/cli/src/index.tsx b/packages/cli/src/index.tsx
index 028ed095fd..84329bf2c2 100644
--- a/packages/cli/src/index.tsx
+++ b/packages/cli/src/index.tsx
@@ -39,7 +39,7 @@ import {
export const cli = async () => {
const [command, ...args] = parsedCli._;
if (parsedCli.help) {
- printHelp();
+ printHelp('info');
process.exit(0);
}
@@ -48,6 +48,8 @@ export const cli = async () => {
await validateVersionsBeforeCommand(remotionRoot, 'info');
}
+ const logLevel = await initializeCli(remotionRoot);
+
const isBun = typeof Bun !== 'undefined';
if (isBun) {
const version = Bun.version.split('.');
@@ -61,7 +63,8 @@ export const cli = async () => {
}
}
- Log.info(
+ Log.infoAdvanced(
+ {indent: false, logLevel},
'You are running Remotion with Bun, which is mostly supported. Visit https://remotion.dev/bun for more information.',
);
}
@@ -72,7 +75,6 @@ export const cli = async () => {
? 0
: RenderInternals.registerErrorSymbolicationLock();
- const logLevel = await initializeCli(remotionRoot);
handleCtrlC({indent: false, logLevel});
try {
@@ -101,24 +103,25 @@ export const cli = async () => {
remotionRoot,
parsedCli['package-manager'],
parsedCli.version,
+ logLevel,
);
} else if (command === VERSIONS_COMMAND) {
await versionsCommand(remotionRoot, logLevel);
} else if (command === 'benchmark') {
await benchmarkCommand(remotionRoot, args, logLevel);
} else if (command === 'help') {
- printHelp();
+ printHelp(logLevel);
process.exit(0);
} else {
if (command) {
Log.error({indent: false, logLevel}, `Command ${command} not found.`);
}
- printHelp();
+ printHelp(logLevel);
process.exit(1);
}
} catch (err) {
- Log.info();
+ Log.infoAdvanced({indent: false, logLevel});
await printError(err as Error, logLevel);
cleanupBeforeQuit({indent: false, logLevel});
process.exit(1);
diff --git a/packages/cli/src/print-compositions.ts b/packages/cli/src/print-compositions.ts
index 2eef8bd424..351954fe2e 100644
--- a/packages/cli/src/print-compositions.ts
+++ b/packages/cli/src/print-compositions.ts
@@ -1,3 +1,4 @@
+import type {LogLevel} from '@remotion/renderer';
import type {VideoConfig} from 'remotion';
import {Log} from './log';
import {quietFlagProvided} from './parse-command-line';
@@ -18,15 +19,24 @@ const max = (arr: number[]) => {
return biggest;
};
-export const printCompositions = (compositions: VideoConfig[]) => {
+export const printCompositions = (
+ compositions: VideoConfig[],
+ logLevel: LogLevel,
+) => {
if (!quietFlagProvided()) {
- Log.info();
- Log.info('The following compositions are available:');
- Log.info();
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ 'The following compositions are available:',
+ );
+ Log.infoAdvanced({indent: false, logLevel});
}
if (quietFlagProvided()) {
- Log.info(compositions.map((c) => c.id).join(' '));
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ compositions.map((c) => c.id).join(' '),
+ );
return;
}
@@ -34,7 +44,8 @@ export const printCompositions = (compositions: VideoConfig[]) => {
const secondColumnLength = 8;
const thirdColumnLength = 15;
- Log.info(
+ Log.infoAdvanced(
+ {indent: false, logLevel},
compositions
.map((comp) => {
const isStill = comp.durationInFrames === 1;
diff --git a/packages/cli/src/print-help.ts b/packages/cli/src/print-help.ts
index 475f0f99fa..d0eb51bcb6 100644
--- a/packages/cli/src/print-help.ts
+++ b/packages/cli/src/print-help.ts
@@ -1,3 +1,4 @@
+import type {LogLevel} from '@remotion/renderer';
import {chalk} from './chalk';
import {GPU_COMMAND} from './gpu';
import {Log} from './log';
@@ -5,70 +6,144 @@ import {VERSIONS_COMMAND} from './versions';
const packagejson = require('../package.json');
-export const printHelp = () => {
- Log.info(`@remotion/cli ${packagejson.version}`);
- Log.info(`Β© ${new Date().getFullYear()} Remotion AG`);
- Log.info();
- Log.info('Available commands:');
+export const printHelp = (logLevel: LogLevel) => {
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ `@remotion/cli ${packagejson.version}`,
+ );
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ `Β© ${new Date().getFullYear()} Remotion AG`,
+ );
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced({indent: false, logLevel}, 'Available commands:');
- Log.info();
- Log.info(chalk.blue('remotion studio') + chalk.gray(' <entry-point.ts>'));
- Log.info('Start the Remotion studio.');
- Log.info(chalk.gray('https://www.remotion.dev/docs/cli/studio'));
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ chalk.blue('remotion studio') + chalk.gray(' <entry-point.ts>'),
+ );
+ Log.infoAdvanced({indent: false, logLevel}, 'Start the Remotion studio.');
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ chalk.gray('https://www.remotion.dev/docs/cli/studio'),
+ );
- Log.info();
- Log.info(
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced(
+ {indent: false, logLevel},
chalk.blue('remotion render') +
chalk.gray(' <entry-point.ts> <comp-id> <output-file.mp4>'),
);
- Log.info('Render video, audio or an image sequence.');
- Log.info(chalk.gray('https://www.remotion.dev/docs/cli/render'));
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ 'Render video, audio or an image sequence.',
+ );
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ chalk.gray('https://www.remotion.dev/docs/cli/render'),
+ );
- Log.info();
- Log.info(
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced(
+ {indent: false, logLevel},
chalk.blue('remotion still') +
chalk.gray(' <entry-point.ts> <comp-id> <still.png>'),
);
- Log.info('Render a still frame and save it as an image.');
- Log.info(chalk.gray('https://www.remotion.dev/docs/cli/still'));
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ 'Render a still frame and save it as an image.',
+ );
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ chalk.gray('https://www.remotion.dev/docs/cli/still'),
+ );
- Log.info();
- Log.info(chalk.blue('remotion bundle') + chalk.gray(' <entry-point.ts>'));
- Log.info('Create a Remotion bundle to be deployed to the web.');
- Log.info(chalk.gray('https://www.remotion.dev/docs/cli/bundle'));
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ chalk.blue('remotion bundle') + chalk.gray(' <entry-point.ts>'),
+ );
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ 'Create a Remotion bundle to be deployed to the web.',
+ );
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ chalk.gray('https://www.remotion.dev/docs/cli/bundle'),
+ );
- Log.info();
- Log.info(
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced(
+ {indent: false, logLevel},
chalk.blue('remotion compositions') + chalk.gray(' <index-file.ts>'),
);
- Log.info('Prints the available compositions.');
- Log.info(chalk.gray('https://www.remotion.dev/docs/cli/compositions'));
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ 'Prints the available compositions.',
+ );
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ chalk.gray('https://www.remotion.dev/docs/cli/compositions'),
+ );
- Log.info();
- Log.info(
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced(
+ {indent: false, logLevel},
chalk.blue('remotion benchmark') +
chalk.gray(' <index-file.ts> <list-of-compositions>'),
);
- Log.info('Benchmarks rendering a composition. Same options as for render.');
- Log.info(chalk.gray('https://www.remotion.dev/docs/cli/benchmark'));
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ 'Benchmarks rendering a composition. Same options as for render.',
+ );
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ chalk.gray('https://www.remotion.dev/docs/cli/benchmark'),
+ );
- Log.info();
- Log.info(chalk.blue('remotion ' + VERSIONS_COMMAND));
- Log.info('Prints and validates versions of all Remotion packages.');
- Log.info(chalk.gray('https://www.remotion.dev/docs/cli/versions'));
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ chalk.blue('remotion ' + VERSIONS_COMMAND),
+ );
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ 'Prints and validates versions of all Remotion packages.',
+ );
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ chalk.gray('https://www.remotion.dev/docs/cli/versions'),
+ );
- Log.info();
- Log.info(chalk.blue('remotion ' + GPU_COMMAND));
- Log.info('Prints information about how Chrome uses the CPU.');
- Log.info(chalk.gray('https://www.remotion.dev/docs/cli/gpu'));
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ chalk.blue('remotion ' + GPU_COMMAND),
+ );
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ 'Prints information about how Chrome uses the CPU.',
+ );
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ chalk.gray('https://www.remotion.dev/docs/cli/gpu'),
+ );
- Log.info();
- Log.info(chalk.blue('remotion upgrade'));
- Log.info('Ensure Remotion is on the newest version.');
- Log.info(chalk.gray('https://www.remotion.dev/docs/cli/upgrade'));
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced({indent: false, logLevel}, chalk.blue('remotion upgrade'));
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ 'Ensure Remotion is on the newest version.',
+ );
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ chalk.gray('https://www.remotion.dev/docs/cli/upgrade'),
+ );
- Log.info();
- Log.info(
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced(
+ {indent: false, logLevel},
'Visit https://www.remotion.dev/docs/cli for browsable CLI documentation.',
);
};
diff --git a/packages/cli/src/upgrade.ts b/packages/cli/src/upgrade.ts
index b67b0e077c..ab8e1f8d04 100644
--- a/packages/cli/src/upgrade.ts
+++ b/packages/cli/src/upgrade.ts
@@ -1,3 +1,4 @@
+import type {LogLevel} from '@remotion/renderer';
import {RenderInternals} from '@remotion/renderer';
import {BrowserSafeApis} from '@remotion/renderer/client';
import type {PackageManager} from '@remotion/studio-server';
@@ -31,6 +32,7 @@ export const upgrade = async (
remotionRoot: string,
packageManager: string | undefined,
version: string | undefined,
+ logLevel: LogLevel,
) => {
const packageJsonFilePath = path.join(remotionRoot, 'package.json');
const packageJson = require(packageJsonFilePath);
@@ -44,10 +46,17 @@ export const upgrade = async (
let targetVersion: string;
if (version) {
targetVersion = version;
- Log.info('Upgrading to specified version: ' + version);
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ 'Upgrading to specified version: ' + version,
+ );
} else {
targetVersion = await StudioServerInternals.getLatestRemotionVersion();
- Log.info('Newest Remotion version is', targetVersion);
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ 'Newest Remotion version is',
+ targetVersion,
+ );
}
const manager = StudioServerInternals.getPackageManager(
@@ -94,6 +103,6 @@ export const upgrade = async (
}
await prom;
- Log.info('⏫ Remotion has been upgraded!');
- Log.info('https://remotion.dev/changelog');
+ Log.infoAdvanced({indent: false, logLevel}, '⏫ Remotion has been upgraded!');
+ Log.infoAdvanced({indent: false, logLevel}, 'https://remotion.dev/changelog');
};
diff --git a/packages/cli/src/versions.ts b/packages/cli/src/versions.ts
index 1fbf141835..86c4102ee6 100644
--- a/packages/cli/src/versions.ts
+++ b/packages/cli/src/versions.ts
@@ -76,7 +76,7 @@ export const validateVersionsBeforeCommand = async (
Log.warn(logOptions, ` - ${pkg}`);
}
- Log.info();
+ Log.infoAdvanced({indent: false, logLevel});
}
Log.warn(logOptions, 'You may experience breakages such as:');
@@ -101,7 +101,7 @@ export const validateVersionsBeforeCommand = async (
}
Log.warn(logOptions, '-------------');
- Log.info();
+ Log.infoAdvanced({indent: false, logLevel});
};
export const versionsCommand = async (
@@ -115,46 +115,59 @@ export const versionsCommand = async (
const installedVersions = Object.keys(grouped);
- Log.info(`Node.JS = ${process.version}, OS = ${process.platform}`);
- Log.info();
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ `Node.JS = ${process.version}, OS = ${process.platform}`,
+ );
+ Log.infoAdvanced({indent: false, logLevel});
for (const version of installedVersions) {
- Log.info(`On version: ${version}`);
+ Log.infoAdvanced({indent: false, logLevel}, `On version: ${version}`);
for (const pkg of grouped[version]) {
- Log.info(`- ${pkg}`);
+ Log.infoAdvanced({indent: false, logLevel}, `- ${pkg}`);
Log.verbose(
{indent: false, logLevel},
` ${resolveFrom(remotionRoot, `${pkg}/package.json`)}`,
);
}
- Log.info();
+ Log.infoAdvanced({indent: false, logLevel});
}
if (installedVersions.length === 0) {
- Log.info('No Remotion packages found.');
- Log.info('Maybe @remotion/cli is installed globally.');
+ Log.infoAdvanced({indent: false, logLevel}, 'No Remotion packages found.');
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ 'Maybe @remotion/cli is installed globally.',
+ );
- Log.info(
+ Log.infoAdvanced(
+ {indent: false, logLevel},
'If you try to render a video that was bundled with a different version, you will get a warning.',
);
process.exit(1);
}
if (installedVersions.length === 1) {
- Log.info(`βœ… Great! All packages have the same version.`);
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ `βœ… Great! All packages have the same version.`,
+ );
} else {
Log.error(
{indent: false, logLevel},
'Version mismatch: Not all Remotion packages have the same version.',
);
- Log.info(
+ Log.infoAdvanced(
+ {indent: false, logLevel},
'- Make sure your package.json has all Remotion packages pointing to the same version.',
);
- Log.info(
+ Log.infoAdvanced(
+ {indent: false, logLevel},
'- Remove the `^` character in front of a version to pin a package.',
);
if (!RenderInternals.isEqualOrBelowLogLevel(logLevel, 'verbose')) {
- Log.info(
+ Log.infoAdvanced(
+ {indent: false, logLevel},
'- Rerun this command with --log=verbose to see the path of the modules resolved.',
);
}
diff --git a/packages/cloudrun/src/cli/help.ts b/packages/cloudrun/src/cli/help.ts
index a6891e703e..d64788e4c5 100644
--- a/packages/cloudrun/src/cli/help.ts
+++ b/packages/cloudrun/src/cli/help.ts
@@ -1,4 +1,5 @@
import {CliInternals} from '@remotion/cli';
+import type {LogLevel} from '@remotion/renderer';
import {BINARY_NAME} from '../shared/constants';
import {PERMISSIONS_COMMAND} from './commands/permissions';
import {REGIONS_COMMAND} from './commands/regions';
@@ -10,41 +11,74 @@ import {Log} from './log';
const packagejson = require('../../package.json');
-export const printHelp = () => {
- Log.info(
+export const printHelp = (logLevel: LogLevel) => {
+ Log.infoAdvanced(
+ {indent: false, logLevel},
`${BINARY_NAME} ${
packagejson.version
} Β© ${new Date().getFullYear()} The Remotion developers`,
);
- Log.info();
- Log.info('Available commands:');
- Log.info('');
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced({indent: false, logLevel}, 'Available commands:');
+ Log.infoAdvanced({indent: false, logLevel}, '');
- Log.info();
- Log.info(`${BINARY_NAME} ${RENDER_COMMAND}`);
- Log.info(CliInternals.chalk.gray('Render Remotion media on GCP Cloud Run.'));
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ `${BINARY_NAME} ${RENDER_COMMAND}`,
+ );
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ CliInternals.chalk.gray('Render Remotion media on GCP Cloud Run.'),
+ );
- Log.info();
- Log.info(`${BINARY_NAME} ${STILL_COMMAND}`);
- Log.info(CliInternals.chalk.gray('Render Remotion still on GCP Cloud Run.'));
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ `${BINARY_NAME} ${STILL_COMMAND}`,
+ );
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ CliInternals.chalk.gray('Render Remotion still on GCP Cloud Run.'),
+ );
- Log.info();
- Log.info(`${BINARY_NAME} ${SERVICES_COMMAND}`);
- Log.info(
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ `${BINARY_NAME} ${SERVICES_COMMAND}`,
+ );
+ Log.infoAdvanced(
+ {indent: false, logLevel},
CliInternals.chalk.gray('Deploy and manage Cloud Run services on GCP.'),
);
- Log.info();
- Log.info(`${BINARY_NAME} ${SITES_COMMAND}`);
- Log.info(CliInternals.chalk.gray('Deploy and manage Remotion projects.'));
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ `${BINARY_NAME} ${SITES_COMMAND}`,
+ );
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ CliInternals.chalk.gray('Deploy and manage Remotion projects.'),
+ );
- Log.info();
- Log.info(`${BINARY_NAME} ${PERMISSIONS_COMMAND}`);
- Log.info(
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ `${BINARY_NAME} ${PERMISSIONS_COMMAND}`,
+ );
+ Log.infoAdvanced(
+ {indent: false, logLevel},
CliInternals.chalk.gray('View and validate required GCP permissions.'),
);
- Log.info();
- Log.info(`${BINARY_NAME} ${REGIONS_COMMAND}`);
- Log.info(CliInternals.chalk.gray('Show the list of GCP regions supported.'));
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ `${BINARY_NAME} ${REGIONS_COMMAND}`,
+ );
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ CliInternals.chalk.gray('Show the list of GCP regions supported.'),
+ );
};
diff --git a/packages/cloudrun/src/cli/index.ts b/packages/cloudrun/src/cli/index.ts
index 257407d128..e7f8a65557 100644
--- a/packages/cloudrun/src/cli/index.ts
+++ b/packages/cloudrun/src/cli/index.ts
@@ -18,7 +18,7 @@ const matchCommand = (
logLevel: LogLevel,
) => {
if (parsedCloudrunCli.help || args.length === 0 || args[0] === 'help') {
- printHelp();
+ printHelp(logLevel);
quit(0);
}
@@ -52,7 +52,7 @@ const matchCommand = (
}
Log.error({indent: false, logLevel}, `Command ${args[0]} not found.`);
- printHelp();
+ printHelp(logLevel);
quit(1);
};
diff --git a/packages/lambda/src/cli/commands/compositions/index.ts b/packages/lambda/src/cli/commands/compositions/index.ts
index 594b3ea1c9..3a81911261 100644
--- a/packages/lambda/src/cli/commands/compositions/index.ts
+++ b/packages/lambda/src/cli/commands/compositions/index.ts
@@ -76,5 +76,5 @@ export const compositionsCommand = async (
forceBucketName: parsedLambdaCli['force-bucket-name'],
});
- CliInternals.printCompositions(comps);
+ CliInternals.printCompositions(comps, logLevel);
};
diff --git a/packages/lambda/src/cli/commands/functions/index.ts b/packages/lambda/src/cli/commands/functions/index.ts
index 91e7134e0f..526838d6ef 100644
--- a/packages/lambda/src/cli/commands/functions/index.ts
+++ b/packages/lambda/src/cli/commands/functions/index.ts
@@ -9,34 +9,50 @@ import {functionsRmallCommand, FUNCTIONS_RMALL_SUBCOMMAND} from './rmall';
export const FUNCTIONS_COMMAND = 'functions';
-const printFunctionsHelp = () => {
- CliInternals.Log.info(`${BINARY_NAME} ${FUNCTIONS_COMMAND} <subcommand>`);
- CliInternals.Log.info();
- CliInternals.Log.info('Available subcommands:');
- CliInternals.Log.info('');
- CliInternals.Log.info(
+const printFunctionsHelp = (logLevel: LogLevel) => {
+ CliInternals.Log.infoAdvanced(
+ {indent: false, logLevel},
+ `${BINARY_NAME} ${FUNCTIONS_COMMAND} <subcommand>`,
+ );
+ CliInternals.Log.infoAdvanced({indent: false, logLevel});
+ CliInternals.Log.infoAdvanced(
+ {indent: false, logLevel},
+ 'Available subcommands:',
+ );
+ CliInternals.Log.infoAdvanced({indent: false, logLevel}, '');
+ CliInternals.Log.infoAdvanced(
+ {indent: false, logLevel},
`${BINARY_NAME} ${FUNCTIONS_COMMAND} ${FUNCTIONS_LS_SUBCOMMAND}`,
);
- CliInternals.Log.info(
+ CliInternals.Log.infoAdvanced(
+ {indent: false, logLevel},
CliInternals.chalk.gray('Lists the functions currently deployed'),
);
- CliInternals.Log.info('');
- CliInternals.Log.info(
+ CliInternals.Log.infoAdvanced({indent: false, logLevel}, '');
+ CliInternals.Log.infoAdvanced(
+ {indent: false, logLevel},
`${BINARY_NAME} ${FUNCTIONS_COMMAND} ${FUNCTIONS_DEPLOY_SUBCOMMAND}`,
);
- CliInternals.Log.info(
+ CliInternals.Log.infoAdvanced(
+ {indent: false, logLevel},
CliInternals.chalk.gray('Deploy a new Lambda function'),
);
- CliInternals.Log.info('');
- CliInternals.Log.info(
+ CliInternals.Log.infoAdvanced({indent: false, logLevel}, '');
+ CliInternals.Log.infoAdvanced(
+ {indent: false, logLevel},
`${BINARY_NAME} ${FUNCTIONS_COMMAND} ${FUNCTIONS_RM_SUBCOMMAND} <function-name>`,
);
- CliInternals.Log.info(CliInternals.chalk.gray('Delete a Lambda function'));
- CliInternals.Log.info('');
- CliInternals.Log.info(
+ CliInternals.Log.infoAdvanced(
+ {indent: false, logLevel},
+ CliInternals.chalk.gray('Delete a Lambda function'),
+ );
+ CliInternals.Log.infoAdvanced({indent: false, logLevel}, '');
+ CliInternals.Log.infoAdvanced(
+ {indent: false, logLevel},
`${BINARY_NAME} ${FUNCTIONS_COMMAND} ${FUNCTIONS_RMALL_SUBCOMMAND}`,
);
- CliInternals.Log.info(
+ CliInternals.Log.infoAdvanced(
+ {indent: false, logLevel},
CliInternals.chalk.gray('Delete all functions in selected region'),
);
};
@@ -63,9 +79,9 @@ export const functionsCommand = (args: string[], logLevel: LogLevel) => {
{indent: false, logLevel},
`Subcommand ${args[0]} not found.`,
);
- printFunctionsHelp();
+ printFunctionsHelp(logLevel);
quit(1);
}
- printFunctionsHelp();
+ printFunctionsHelp(logLevel);
};
diff --git a/packages/lambda/src/cli/commands/quotas/index.ts b/packages/lambda/src/cli/commands/quotas/index.ts
index 6fd48976f3..e3810a4425 100644
--- a/packages/lambda/src/cli/commands/quotas/index.ts
+++ b/packages/lambda/src/cli/commands/quotas/index.ts
@@ -5,18 +5,29 @@ import {INCREASE_SUBCOMMAND, quotasIncreaseCommand} from './increase';
import {quotasListCommand} from './list';
export const QUOTAS_COMMAND = 'quotas';
-const printHelp = () => {
- CliInternals.Log.info('Available commands:');
- CliInternals.Log.info();
- CliInternals.Log.info(`npx ${BINARY_NAME} ${QUOTAS_COMMAND}`);
- CliInternals.Log.info(
+const printHelp = (logLevel: LogLevel) => {
+ CliInternals.Log.infoAdvanced(
+ {indent: false, logLevel},
+ 'Available commands:',
+ );
+ CliInternals.Log.infoAdvanced({indent: false, logLevel});
+ CliInternals.Log.infoAdvanced(
+ {indent: false, logLevel},
+ `npx ${BINARY_NAME} ${QUOTAS_COMMAND}`,
+ );
+ CliInternals.Log.infoAdvanced(
+ {indent: false, logLevel},
CliInternals.chalk.gray('List relevant AWS Lambda quotas.'),
);
- CliInternals.Log.info();
- CliInternals.Log.info(
+ CliInternals.Log.infoAdvanced({indent: false, logLevel});
+ CliInternals.Log.infoAdvanced(
+ {indent: false, logLevel},
`npx ${BINARY_NAME} ${QUOTAS_COMMAND} ${INCREASE_SUBCOMMAND}`,
);
- CliInternals.Log.info(CliInternals.chalk.gray('Increase Lambda quotas.'));
+ CliInternals.Log.infoAdvanced(
+ {indent: false, logLevel},
+ CliInternals.chalk.gray('Increase Lambda quotas.'),
+ );
};
export const quotasCommand = (args: string[], logLevel: LogLevel) => {
@@ -32,5 +43,5 @@ export const quotasCommand = (args: string[], logLevel: LogLevel) => {
{indent: false, logLevel},
'Subcommand ' + args[0] + ' not found.',
);
- printHelp();
+ printHelp(logLevel);
};
diff --git a/packages/lambda/src/cli/commands/quotas/list.ts b/packages/lambda/src/cli/commands/quotas/list.ts
index e22c93a909..d88d52bb00 100644
--- a/packages/lambda/src/cli/commands/quotas/list.ts
+++ b/packages/lambda/src/cli/commands/quotas/list.ts
@@ -18,8 +18,11 @@ import {INCREASE_SUBCOMMAND} from './increase';
export const quotasListCommand = async (logLevel: LogLevel) => {
const region = getAwsRegion();
- Log.info(CliInternals.chalk.gray(`Region = ${region}`));
- Log.info();
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ CliInternals.chalk.gray(`Region = ${region}`),
+ );
+ Log.infoAdvanced({indent: false, logLevel});
const [concurrencyLimit, defaultConcurrencyLimit, burstLimit, changes] =
await Promise.all([
getServiceQuotasClient(region).send(
@@ -60,7 +63,8 @@ export const quotasListCommand = async (logLevel: LogLevel) => {
const effectiveBurstConcurrency = Math.min(burstDefault, defaultConcurrency);
if (increaseRecommended) {
- Log.info(
+ Log.infoAdvanced(
+ {indent: false, logLevel},
`Concurrency limit: ${concurrencyCurrent} - ${
increaseRecommended
? CliInternals.chalk.greenBright('Increase recommended!')
@@ -68,7 +72,10 @@ export const quotasListCommand = async (logLevel: LogLevel) => {
}`,
);
} else {
- Log.info(`Concurrency limit: ${concurrencyCurrent}`);
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ `Concurrency limit: ${concurrencyCurrent}`,
+ );
}
if (openCase) {
@@ -82,27 +89,34 @@ export const quotasListCommand = async (logLevel: LogLevel) => {
);
}
- Log.info(
+ Log.infoAdvanced(
+ {indent: false, logLevel},
CliInternals.chalk.gray(
'The maximum amount of Lambda functions which can concurrently execute.',
),
);
- Log.info(
+ Log.infoAdvanced(
+ {indent: false, logLevel},
CliInternals.chalk.gray(
`Run \`npx ${BINARY_NAME} ${QUOTAS_COMMAND} ${INCREASE_SUBCOMMAND}\` to ask AWS to increase your limit.`,
),
);
- Log.info();
+ Log.infoAdvanced({indent: false, logLevel});
if (effectiveBurstConcurrency === burstDefault) {
- Log.info(`Burst concurrency: ${burstDefault}`);
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ `Burst concurrency: ${burstDefault}`,
+ );
} else {
- Log.info(
+ Log.infoAdvanced(
+ {indent: false, logLevel},
`Burst concurrency: ${burstDefault}, but only ${effectiveBurstConcurrency} effective because of concurrency limit`,
);
}
- Log.info(
+ Log.infoAdvanced(
+ {indent: false, logLevel},
CliInternals.chalk.gray(
'The maximum amount of concurrency increase in 10 seconds',
),
diff --git a/packages/lambda/src/cli/commands/render/render.ts b/packages/lambda/src/cli/commands/render/render.ts
index 1c50b4cafd..0481757b8e 100644
--- a/packages/lambda/src/cli/commands/render/render.ts
+++ b/packages/lambda/src/cli/commands/render/render.ts
@@ -66,11 +66,13 @@ export const renderCommand = async (
const serveUrl = args[0];
if (!serveUrl) {
Log.error({indent: false, logLevel}, 'No serve URL passed.');
- Log.info(
+ Log.infoAdvanced(
+ {indent: false, logLevel},
'Pass an additional argument specifying a URL where your Remotion project is hosted.',
);
- Log.info();
- Log.info(
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced(
+ {indent: false, logLevel},
`${BINARY_NAME} ${RENDER_COMMAND} <serve-url> <composition-id> [output-location]`,
);
quit(1);
@@ -159,7 +161,10 @@ export const renderCommand = async (
let composition: string = args[1];
if (!composition) {
- Log.info('No compositions passed. Fetching compositions...');
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ 'No compositions passed. Fetching compositions...',
+ );
validateServeUrl(serveUrl);
@@ -300,12 +305,14 @@ export const renderCommand = async (
indent: false,
});
- Log.info(
+ Log.infoAdvanced(
+ {indent: false, logLevel},
CliInternals.chalk.gray(
`bucket = ${res.bucketName}, function = ${functionName}`,
),
);
- Log.info(
+ Log.infoAdvanced(
+ {indent: false, logLevel},
CliInternals.chalk.gray(
`renderId = ${res.renderId}, codec = ${codec} (${reason})`,
),
@@ -422,16 +429,25 @@ export const renderCommand = async (
}),
false,
);
- Log.info();
- Log.info();
- Log.info('Done!', outputPath, CliInternals.formatBytes(sizeInBytes));
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ 'Done!',
+ outputPath,
+ CliInternals.formatBytes(sizeInBytes),
+ );
} else {
- Log.info();
- Log.info();
- Log.info('Done! ' + newStatus.outputFile);
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ 'Done! ' + newStatus.outputFile,
+ );
}
- Log.info(
+ Log.infoAdvanced(
+ {indent: false, logLevel},
[
newStatus.renderMetadata
? `${newStatus.renderMetadata.estimatedTotalLambdaInvokations} Ξ»'s used`
@@ -484,11 +500,13 @@ export const renderCommand = async (
await CliInternals.printError(errorWithStackFrame, logLevel);
}
- Log.info();
- Log.info(
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced(
+ {indent: false, logLevel},
`Accrued costs until error was thrown: ${newStatus.costs.displayCost}.`,
);
- Log.info(
+ Log.infoAdvanced(
+ {indent: false, logLevel},
'This is an estimate and continuing Lambda functions may incur additional costs.',
);
quit(1);
diff --git a/packages/lambda/src/cli/commands/sites/create.ts b/packages/lambda/src/cli/commands/sites/create.ts
index 4ca86e2926..641f94335c 100644
--- a/packages/lambda/src/cli/commands/sites/create.ts
+++ b/packages/lambda/src/cli/commands/sites/create.ts
@@ -38,11 +38,15 @@ export const sitesCreateSubcommand = async (
);
if (!file) {
Log.error({indent: false, logLevel}, 'No entry file passed.');
- Log.info(
+ Log.infoAdvanced(
+ {indent: false, logLevel},
'Pass an additional argument specifying the entry file of your Remotion project:',
);
- Log.info();
- Log.info(`${BINARY_NAME} deploy <entry-file.ts>`);
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ `${BINARY_NAME} deploy <entry-file.ts>`,
+ );
quit(1);
return;
}
@@ -168,20 +172,22 @@ export const sitesCreateSubcommand = async (
};
updateProgress();
- Log.info();
- Log.info();
- Log.info('Deployed to S3!');
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced({indent: false, logLevel}, 'Deployed to S3!');
- Log.info(`Serve URL: ${serveUrl}`);
- Log.info(`Site Name: ${siteName}`);
+ Log.infoAdvanced({indent: false, logLevel}, `Serve URL: ${serveUrl}`);
+ Log.infoAdvanced({indent: false, logLevel}, `Site Name: ${siteName}`);
- Log.info();
- Log.info(
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced(
+ {indent: false, logLevel},
CliInternals.chalk.blueBright(
'ℹ️ If you make changes to your code, you need to redeploy the site. You can overwrite the existing site by running:',
),
);
- Log.info(
+ Log.infoAdvanced(
+ {indent: false, logLevel},
CliInternals.chalk.blueBright(
['npx remotion lambda sites create', args[0], `--site-name=${siteName}`]
.filter(NoReactInternals.truthy)
diff --git a/packages/lambda/src/cli/commands/sites/index.ts b/packages/lambda/src/cli/commands/sites/index.ts
index 5e72906232..07a24b4f72 100644
--- a/packages/lambda/src/cli/commands/sites/index.ts
+++ b/packages/lambda/src/cli/commands/sites/index.ts
@@ -9,36 +9,50 @@ import {sitesRmallSubcommand, SITES_RMALL_COMMAND} from './rmall';
export const SITES_COMMAND = 'sites';
-const printSitesHelp = () => {
- CliInternals.Log.info(`${BINARY_NAME} ${SITES_COMMAND} <subcommand>`);
- CliInternals.Log.info();
- CliInternals.Log.info('Available subcommands:');
- CliInternals.Log.info();
- CliInternals.Log.info(
+const printSitesHelp = (logLevel: LogLevel) => {
+ CliInternals.Log.infoAdvanced(
+ {indent: false, logLevel},
+ `${BINARY_NAME} ${SITES_COMMAND} <subcommand>`,
+ );
+ CliInternals.Log.infoAdvanced({indent: false, logLevel});
+ CliInternals.Log.infoAdvanced(
+ {indent: false, logLevel},
+ 'Available subcommands:',
+ );
+ CliInternals.Log.infoAdvanced({indent: false, logLevel});
+ CliInternals.Log.infoAdvanced(
+ {indent: false, logLevel},
`${BINARY_NAME} ${SITES_COMMAND} ${SITES_CREATE_SUBCOMMAND} <entry-point>`,
);
- CliInternals.Log.info(
+ CliInternals.Log.infoAdvanced(
+ {indent: false, logLevel},
CliInternals.chalk.gray('Creates a new site based on a Remotion project'),
);
- CliInternals.Log.info();
- CliInternals.Log.info(
+ CliInternals.Log.infoAdvanced({indent: false, logLevel});
+ CliInternals.Log.infoAdvanced(
+ {indent: false, logLevel},
`${BINARY_NAME} ${SITES_COMMAND} ${SITES_LS_SUBCOMMAND}`,
);
- CliInternals.Log.info(
+ CliInternals.Log.infoAdvanced(
+ {indent: false, logLevel},
CliInternals.chalk.gray('Lists the sites currently deployed'),
);
- CliInternals.Log.info();
- CliInternals.Log.info(
+ CliInternals.Log.infoAdvanced({indent: false, logLevel});
+ CliInternals.Log.infoAdvanced(
+ {indent: false, logLevel},
`${BINARY_NAME} ${SITES_COMMAND} ${SITES_RM_COMMAND} <site-id>`,
);
- CliInternals.Log.info(
+ CliInternals.Log.infoAdvanced(
+ {indent: false, logLevel},
CliInternals.chalk.gray('Remove a site from the S3 bucket.'),
);
- CliInternals.Log.info();
- CliInternals.Log.info(
+ CliInternals.Log.infoAdvanced({indent: false, logLevel});
+ CliInternals.Log.infoAdvanced(
+ {indent: false, logLevel},
`${BINARY_NAME} ${SITES_COMMAND} ${SITES_RMALL_COMMAND}`,
);
- CliInternals.Log.info(
+ CliInternals.Log.infoAdvanced(
+ {indent: false, logLevel},
CliInternals.chalk.gray('Remove all sites from the S3 bucket.'),
);
};
@@ -69,9 +83,9 @@ export const sitesCommand = (
{indent: false, logLevel},
`Subcommand ${args[0]} not found.`,
);
- printSitesHelp();
+ printSitesHelp(logLevel);
quit(1);
}
- printSitesHelp();
+ printSitesHelp(logLevel);
};
diff --git a/packages/lambda/src/cli/help.ts b/packages/lambda/src/cli/help.ts
index 466b9a7a5e..d2e66ba6cc 100644
--- a/packages/lambda/src/cli/help.ts
+++ b/packages/lambda/src/cli/help.ts
@@ -1,4 +1,5 @@
import {CliInternals} from '@remotion/cli';
+import type {LogLevel} from '@remotion/renderer';
import {BINARY_NAME} from '../shared/constants';
import {COMPOSITIONS_COMMAND} from './commands/compositions';
import {FUNCTIONS_COMMAND} from './commands/functions';
@@ -12,47 +13,92 @@ import {Log} from './log';
const packagejson = require('../../package.json');
-export const printHelp = () => {
- Log.info(
+export const printHelp = (logLevel: LogLevel) => {
+ Log.infoAdvanced(
+ {indent: false, logLevel},
`${BINARY_NAME} ${
packagejson.version
} Β© ${new Date().getFullYear()} The Remotion developers`,
);
- Log.info();
- Log.info('Available commands:');
- Log.info('');
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced({indent: false, logLevel}, 'Available commands:');
+ Log.infoAdvanced({indent: false, logLevel}, '');
- Log.info(`${BINARY_NAME} ${RENDER_COMMAND} <s3-url> <composition-id>`);
- Log.info(CliInternals.chalk.gray('Render a video in the cloud.'));
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ `${BINARY_NAME} ${RENDER_COMMAND} <s3-url> <composition-id>`,
+ );
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ CliInternals.chalk.gray('Render a video in the cloud.'),
+ );
- Log.info(`${BINARY_NAME} ${STILL_COMMAND} <s3-url> <composition-id>`);
- Log.info(CliInternals.chalk.gray('Render a still image in the cloud.'));
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ `${BINARY_NAME} ${STILL_COMMAND} <s3-url> <composition-id>`,
+ );
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ CliInternals.chalk.gray('Render a still image in the cloud.'),
+ );
- Log.info();
- Log.info(`${BINARY_NAME} ${FUNCTIONS_COMMAND}`);
- Log.info(CliInternals.chalk.gray('Deploy and manage AWS Lambda functions.'));
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ `${BINARY_NAME} ${FUNCTIONS_COMMAND}`,
+ );
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ CliInternals.chalk.gray('Deploy and manage AWS Lambda functions.'),
+ );
- Log.info();
- Log.info(`${BINARY_NAME} ${SITES_COMMAND}`);
- Log.info(CliInternals.chalk.gray('Deploy and manage Remotion projects.'));
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ `${BINARY_NAME} ${SITES_COMMAND}`,
+ );
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ CliInternals.chalk.gray('Deploy and manage Remotion projects.'),
+ );
- Log.info();
- Log.info(`${BINARY_NAME} ${COMPOSITIONS_COMMAND}`);
- Log.info(
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ `${BINARY_NAME} ${COMPOSITIONS_COMMAND}`,
+ );
+ Log.infoAdvanced(
+ {indent: false, logLevel},
CliInternals.chalk.gray('Print list of composition IDs from a serve URL.'),
);
- Log.info();
- Log.info(`${BINARY_NAME} ${POLICIES_COMMAND}`);
- Log.info(CliInternals.chalk.gray('View and validate AWS policy files.'));
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ `${BINARY_NAME} ${POLICIES_COMMAND}`,
+ );
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ CliInternals.chalk.gray('View and validate AWS policy files.'),
+ );
- Log.info();
- Log.info(`${BINARY_NAME} ${REGIONS_COMMAND}`);
- Log.info(CliInternals.chalk.gray('Show the list of AWS regions supported.'));
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ `${BINARY_NAME} ${REGIONS_COMMAND}`,
+ );
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ CliInternals.chalk.gray('Show the list of AWS regions supported.'),
+ );
- Log.info();
- Log.info(`${BINARY_NAME} ${QUOTAS_COMMAND}`);
- Log.info(
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ `${BINARY_NAME} ${QUOTAS_COMMAND}`,
+ );
+ Log.infoAdvanced(
+ {indent: false, logLevel},
CliInternals.chalk.gray('Shows AWS quotas and allows to increase them.'),
);
};
diff --git a/packages/lambda/src/cli/index.ts b/packages/lambda/src/cli/index.ts
index a5ce75d1bd..0fbb0c4061 100644
--- a/packages/lambda/src/cli/index.ts
+++ b/packages/lambda/src/cli/index.ts
@@ -48,7 +48,7 @@ const matchCommand = (
logLevel: LogLevel,
) => {
if (parsedLambdaCli.help || args.length === 0) {
- printHelp();
+ printHelp(logLevel);
quit(0);
}
@@ -118,7 +118,7 @@ const matchCommand = (
}
Log.error({indent: false, logLevel}, `Command ${args[0]} not found.`);
- printHelp();
+ printHelp(logLevel);
quit(1);
};
diff --git a/packages/lambda/src/functions/helpers/get-browser-instance.ts b/packages/lambda/src/functions/helpers/get-browser-instance.ts
index fcdf5dfa56..b246008b3f 100644
--- a/packages/lambda/src/functions/helpers/get-browser-instance.ts
+++ b/packages/lambda/src/functions/helpers/get-browser-instance.ts
@@ -66,10 +66,16 @@ export const getBrowserInstance = async (
actualChromiumOptions,
logLevel,
);
- RenderInternals.Log.info(`Rendering with Remotion v${VERSION}.`);
+ RenderInternals.Log.infoAdvanced(
+ {indent: false, logLevel},
+ `Rendering with Remotion v${VERSION}.`,
+ );
if (launching) {
- RenderInternals.Log.info('Already waiting for browser launch...');
+ RenderInternals.Log.infoAdvanced(
+ {indent: false, logLevel},
+ 'Already waiting for browser launch...',
+ );
await waitForLaunched();
if (!_browserInstance) {
throw new Error('expected to launch');
@@ -77,7 +83,8 @@ export const getBrowserInstance = async (
}
if (!_browserInstance) {
- RenderInternals.Log.info(
+ RenderInternals.Log.infoAdvanced(
+ {indent: false, logLevel},
'Cold Lambda function, launching new browser instance',
);
launching = true;
@@ -94,10 +101,17 @@ export const getBrowserInstance = async (
logLevel,
});
instance.on('disconnected', () => {
- RenderInternals.Log.info('Browser disconnected or crashed.');
+ RenderInternals.Log.infoAdvanced(
+ {indent: false, logLevel},
+ 'Browser disconnected or crashed.',
+ );
forgetBrowserEventLoop(logLevel);
_browserInstance?.instance?.close(true, logLevel, indent).catch((err) => {
- RenderInternals.Log.info('Could not close browser instance', err);
+ RenderInternals.Log.infoAdvanced(
+ {indent: false, logLevel},
+ 'Could not close browser instance',
+ err,
+ );
});
_browserInstance = null;
});
@@ -111,7 +125,8 @@ export const getBrowserInstance = async (
}
if (_browserInstance.configurationString !== configurationString) {
- RenderInternals.Log.info(
+ RenderInternals.Log.infoAdvanced(
+ {indent: false, logLevel},
'Warm Lambda function, but Browser configuration changed. Killing old browser instance.',
);
_browserInstance.instance.rememberEventLoop();
@@ -120,7 +135,10 @@ export const getBrowserInstance = async (
return getBrowserInstance(logLevel, indent, chromiumOptions);
}
- RenderInternals.Log.info('Warm Lambda function, reusing browser instance');
+ RenderInternals.Log.infoAdvanced(
+ {indent: false, logLevel},
+ 'Warm Lambda function, reusing browser instance',
+ );
_browserInstance.instance.rememberEventLoop();
return _browserInstance;
};
diff --git a/packages/renderer/src/print-useful-error-message.ts b/packages/renderer/src/print-useful-error-message.ts
index 24f01c8d40..ae6074fa1a 100644
--- a/packages/renderer/src/print-useful-error-message.ts
+++ b/packages/renderer/src/print-useful-error-message.ts
@@ -1,10 +1,11 @@
+import type {LogLevel} from './log-level';
import {Log} from './logger';
import {truthy} from './truthy';
const alreadyPrinted: Error[] = [];
-// Don't use Log.info() here, as BrowserSafeApis need tto be
-export const printUsefulErrorMessage = (err: Error) => {
+// Don't use Log.infoAdvanced({indent: false, logLevel},) here, as BrowserSafeApis need tto be
+export const printUsefulErrorMessage = (err: Error, logLevel: LogLevel) => {
if (alreadyPrinted.includes(err)) {
return;
}
@@ -12,8 +13,9 @@ export const printUsefulErrorMessage = (err: Error) => {
alreadyPrinted.push(err);
if (err.message.includes('Could not play video with')) {
- Log.info();
- Log.info(
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced(
+ {indent: false, logLevel},
'πŸ’‘ Get help for this issue at https://remotion.dev/docs/media-playback-error',
);
}
@@ -22,33 +24,40 @@ export const printUsefulErrorMessage = (err: Error) => {
err.message.includes('A delayRender()') &&
err.message.includes('was called but not cleared after')
) {
- Log.info();
+ Log.infoAdvanced({indent: false, logLevel});
if (err.message.includes('/proxy')) {
- Log.info(
+ Log.infoAdvanced(
+ {indent: false, logLevel},
'πŸ’‘ Get help for this issue at https://remotion.dev/docs/troubleshooting/delay-render-proxy',
);
}
- Log.info('πŸ’‘ Get help for this issue at https://remotion.dev/docs/timeout');
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ 'πŸ’‘ Get help for this issue at https://remotion.dev/docs/timeout',
+ );
}
if (err.message.includes('Target closed')) {
- Log.info();
- Log.info(
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced(
+ {indent: false, logLevel},
'πŸ’‘ Get help for this issue at https://remotion.dev/docs/target-closed',
);
}
if (err.message.includes('Timed out evaluating')) {
- Log.info();
- Log.info(
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced(
+ {indent: false, logLevel},
'πŸ’‘ Get help for this issue at https://remotion.dev/docs/troubleshooting/timed-out-page-function',
);
}
if (err.message.includes('ENAMETOOLONG')) {
- Log.info();
- Log.info(
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced(
+ {indent: false, logLevel},
'πŸ’‘ Get help for this issue at https://remotion.dev/docs/enametoolong',
);
}
@@ -56,21 +65,23 @@ export const printUsefulErrorMessage = (err: Error) => {
if (
err.message.includes('Member must have value less than or equal to 3008')
) {
- Log.info();
- Log.info(
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced(
+ {indent: false, logLevel},
'πŸ’‘ This error indicates that you have a AWS account on the free tier or have been limited by your organization. Often times this can be solved by adding a credit card. See also: https://repost.aws/questions/QUKruWYNDYTSmP17jCnIz6IQ/questions/QUKruWYNDYTSmP17jCnIz6IQ/unable-to-set-lambda-memory-over-3008mb',
);
}
if (err.stack?.includes('TooManyRequestsException: Rate Exceeded.')) {
- Log.info();
- Log.info(
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced(
+ {indent: false, logLevel},
'πŸ’‘ This error indicates that your Lambda concurrency limit is too low. See: https://www.remotion.dev/docs/lambda/troubleshooting/rate-limit',
);
}
if (err.message.includes('Error creating WebGL context')) {
- Log.info();
+ Log.infoAdvanced({indent: false, logLevel});
console.warn(
'πŸ’‘ You might need to set the OpenGL renderer to "angle-egl", "angle" (or "swangle" if rendering on lambda). Learn why at https://www.remotion.dev/docs/three',
);
@@ -80,15 +91,17 @@ export const printUsefulErrorMessage = (err: Error) => {
}
if (err.message.includes('The bucket does not allow ACLs')) {
- Log.info();
- Log.info(
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced(
+ {indent: false, logLevel},
'πŸ’‘ Fix for this issue: https://remotion.dev/docs/lambda/troubleshooting/bucket-disallows-acl',
);
}
if (err.message.includes('Minified React error #306')) {
const componentName = err.message.match(/<\w+>/)?.[0];
- Log.info(
+ Log.infoAdvanced(
+ {indent: false, logLevel},
[
'πŸ’‘ This error indicates that the component',
componentName ? `(${componentName})` : null,
@@ -98,27 +111,40 @@ export const printUsefulErrorMessage = (err: Error) => {
.join(' '),
);
- Log.info();
- Log.info(
+ Log.infoAdvanced({indent: false, logLevel});
+ Log.infoAdvanced(
+ {indent: false, logLevel},
' Check the root file and ensure that the component is not undefined.',
);
- Log.info(
+ Log.infoAdvanced(
+ {indent: false, logLevel},
' Oftentimes, this happens if the component is missing the `export` keyword',
);
- Log.info(
+ Log.infoAdvanced(
+ {indent: false, logLevel},
' or if the component was renamed and the import statement not properly adjusted.',
);
}
if (err.message.includes('GLIBC_')) {
- Log.info('πŸ’‘ Remotion requires at least Libc 2.35.');
- Log.info(
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ 'πŸ’‘ Remotion requires at least Libc 2.35.',
+ );
+ Log.infoAdvanced(
+ {indent: false, logLevel},
'πŸ’‘ Get help for this issue: https://github.com/remotion-dev/remotion/issues/2439',
);
}
if (err.message.includes('EBADF')) {
- Log.info('πŸ’‘ This error might be fixed by changing your Node version:');
- Log.info(' https://github.com/remotion-dev/remotion/issues/2452');
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ 'πŸ’‘ This error might be fixed by changing your Node version:',
+ );
+ Log.infoAdvanced(
+ {indent: false, logLevel},
+ ' https://github.com/remotion-dev/remotion/issues/2452',
+ );
}
};
diff --git a/packages/renderer/src/wrap-with-error-handling.ts b/packages/renderer/src/wrap-with-error-handling.ts
index 5c4b154e9e..c2887ae3c8 100644
--- a/packages/renderer/src/wrap-with-error-handling.ts
+++ b/packages/renderer/src/wrap-with-error-handling.ts
@@ -9,7 +9,7 @@ export const wrapWithErrorHandling = <A extends unknown[], R>(
try {
return await fn(...args);
} catch (err) {
- printUsefulErrorMessage(err as Error);
+ printUsefulErrorMessage(err as Error, 'info');
throw err;
}
};