🎥 Make videos programmatically with React
only log if specified log level
Jonny Burger97db51b969b3
diff --git a/packages/cli/src/log.ts b/packages/cli/src/log.tsindex b59a6d93b4..90a40c6087 100644--- a/packages/cli/src/log.ts+++ b/packages/cli/src/log.ts@@ -2,11 +2,38 @@import chalk from 'chalk';+export enum LogLevel {+ VERBOSE = 0,+ INFO = 1,+ WARN = 2,+ ERROR = 3,+}++let logLevel = LogLevel.INFO;++export const setLogLevel = (newLogLevel: LogLevel) => {+ logLevel = newLogLevel;+};+export const Log = {- Verbose: (...args: Parameters<typeof console.log>) => console.log(...args),- Info: (...args: Parameters<typeof console.log>) => console.log(...args),- Warn: (...args: Parameters<typeof console.log>) =>- console.log(chalk.yellow(...args)),- Error: (...args: Parameters<typeof console.log>) =>- console.log(chalk.red(...args)),+ Verbose: (...args: Parameters<typeof console.log>) => {+ if (logLevel <= LogLevel.VERBOSE) {+ return console.log(chalk.blueBright(...args));+ }+ },+ Info: (...args: Parameters<typeof console.log>) => {+ if (logLevel <= LogLevel.INFO) {+ return console.log(...args);+ }+ },+ Warn: (...args: Parameters<typeof console.log>) => {+ if (logLevel <= LogLevel.WARN) {+ return console.log(chalk.yellow(...args));+ }+ },+ Error: (...args: Parameters<typeof console.log>) => {+ if (logLevel <= LogLevel.ERROR) {+ return console.log(chalk.red(...args));+ }+ },};