From b9fd554fe0542fbfa967c262d1fe8f0e2dfd0a64 Mon Sep 17 00:00:00 2001 From: Suresh Kumar Gangumalla Date: Wed, 22 Oct 2025 16:03:43 +0530 Subject: [PATCH 1/3] Add a method to set renderer settings at runtime Signed-off-by: Suresh Kumar Gangumalla --- index.d.ts | 307 ++++++++++++++++++---------------- src/component/base/methods.js | 25 +++ 2 files changed, 184 insertions(+), 148 deletions(-) diff --git a/index.d.ts b/index.d.ts index bd5f5a5d..7d6eb457 100644 --- a/index.d.ts +++ b/index.d.ts @@ -293,6 +293,9 @@ declare module '@lightningjs/blits' { } } + type SettingsKey = keyof RendererSettings; + type SettingsValue = RendererSettings[K]; + export type ComponentBase = { /** * Indicates whether the component currently has focus @@ -391,6 +394,11 @@ declare module '@lightningjs/blits' { */ h: number }) => void + + /** + * Update the renderer settings + */ + $settings: (key: K, value: SettingsValue) => void } /** @@ -771,13 +779,7 @@ declare module '@lightningjs/blits' { type ReactivityModes = 'Proxy' | 'defineProperty' type RenderModes = 'webgl' | 'canvas' - /** - * Settings - * - * Launcher function that sets up the Lightning renderer and instantiates - * the Blits App - */ - export interface Settings { + export interface RendererSettings { /** * Width of the Application */ @@ -786,6 +788,155 @@ declare module '@lightningjs/blits' { * Height of the Application */ h?: number, + /** + * Configures the gpu memory settings used by the renderer + */ + gpuMemory?: { + /** + * Maximum GPU memory threshold (in `mb`) after which + * the renderer will immediately start cleaning up textures to free + * up graphical memory + * + * When setting to `0`, texture memory management is disabled + * + * @default `200` + */ + max?: number, + /** + * Target threshold of GPU memory usage, defined as a fraction of + * the max threshold. The renderer will attempt to keep memory + * usage below this target by cleaning up non-renderable textures + * + * @default `0.8` + */ + target?: number, + /** + * Interval at which regular texture cleanups occur (in `ms`) + * + * @default `5000` + */ + cleanupInterval?: number, + /** + * Baseline GPU memory usage of the App (in `mb`), without rendering any + * textures. This value will be used as a basis when calculating + * the total memory usage towards the max and target memory + * usage + * + * @default `25` + */ + baseline?: number, + /** + * Whether or not the max threshold should be considered + * as a strict number that can not be exceeded in any way + * + * When set to `true`, new textures won't be created when the + * max threshold has been reached, until agressive texture cleanup + * has brought the memory back down + * + * @default false + */ + strict?: boolean, + }, + /** + * Add an extra margin to the viewport for earlier pre-loading of elements and components + * + * By default the Lightning renderer, only renders elements that are inside the defined viewport. + * Everything outside of these bounds is removed from the render tree. + * + * With the viewportMargin you have the option to _virtually_ increase the viewport area, + * to expedite the pre-loading of elements and / or delay the unloading of elements depending + * on their position in the (virtual) viewport + * + * The margin can be specified in 4 directions by defining an array [top, right, bottom, left], + * or as a single number which is then applied to all 4 directions equally. + * + * Defaults to `0` + */ + viewportMargin?: number | [number, number, number, number], + /** + * Custom pixel ratio of the device used to convert dimensions + * and positions in the App code to the actual device logical coordinates + * + * Takes presedence over the `screenResolution` setting + * + * Defaults to 1 if not specified + */ + pixelRatio?: number, + /** + * Controls the quality of the rendered App. + * + * Setting a lower quality leads to less detail on screen, but can positively affect overall + * performance and smoothness of the App (i.e. a higher FPS). + * + * The render quality can be one of the following presets: + * + * - `low` => 66% quality + * - `medium` => 85% quality + * - `high` => 100% quality + * - `retina` => 200% quality + * + * It's also possible to provide a custom value as a (decimal) number: + * + * - `0.2` => 20% quality + * - `1.5` => 150% quality + * + * Defaults to 1 (high quality) when not specified + */ + renderQuality?: RenderQualities, + /** + * Background color of the canvas (also known as the clearColor) + * + * Can be a color name (red, blue, silver), a hexadecimal color (`#000000`, `#ccc`), + * or a color number in rgba order (`0xff0033ff`) + * + * Defauls to transparent (`0x00000000`) + * + */ + canvasColor?: string, + /** + * Enable inspector + * + * Enables the inspector tool for debugging and inspecting the application, the node tree + * will be replicated in the DOM and can be inspected using the browser's developer tools + * + * Defaults to `false` + */ + inspector?: boolean, + /** + * Interval in milliseconds to receive FPS updates + * + * @remarks + * If set to `0`, FPS updates will be disabled. + * + * @defaultValue `1000` (disabled) + */ + fpsInterval?: number, + /** + * The maximum amount of time the renderer is allowed to process textures in a + * single frame. If the processing time exceeds this limit, the renderer will + * skip processing the remaining textures and continue rendering the frame. + * + * Defaults to `10` + */ + textureProcessingTimeLimit?: number, + /** + * Maximum FPS at which the App will be rendered + * + * Lowering the maximum FPS value can improve the overall experience on lower end devices. + * Targetting a lower FPS may gives the CPU more time to construct each frame leading to a smoother rendering. + * + * Defaults to `0` which means no maximum + */ + maxFPS?: number + } + + /** + * Settings + * + * Launcher function that sets up the Lightning renderer and instantiates + * the Blits App + */ + export interface Settings extends RendererSettings{ /** * Whether to enable multithreaded */ @@ -848,45 +999,7 @@ declare module '@lightningjs/blits' { * - 2160 */ screenResolution?: ScreenResolutions, - /** - * Controls the quality of the rendered App. - * - * Setting a lower quality leads to less detail on screen, but can positively affect overall - * performance and smoothness of the App (i.e. a higher FPS). - * - * The render quality can be one of the following presets: - * - * - `low` => 66% quality - * - `medium` => 85% quality - * - `high` => 100% quality - * - `retina` => 200% quality - * - * It's also possible to provide a custom value as a (decimal) number: - * - * - `0.2` => 20% quality - * - `1.5` => 150% quality - * - * Defaults to 1 (high quality) when not specified - */ - renderQuality?: RenderQualities, - /** - * Custom pixel ratio of the device used to convert dimensions - * and positions in the App code to the actual device logical coordinates - * - * Takes presedence over the `screenResolution` setting - * - * Defaults to 1 if not specified - */ - pixelRatio?: number - /** - * Interval in milliseconds to receive FPS updates - * - * @remarks - * If set to `0`, FPS updates will be disabled. - * - * @defaultValue `1000` (disabled) - */ - fpsInterval?: number + /** * Maximum number of web workers to spin up simultaneously for offloading functionality such * as image loading to separate threads (when supported by the browser) @@ -895,90 +1008,6 @@ declare module '@lightningjs/blits' { * `navigator.hardwareConcurrency` (or 2 if `navigator.hardwareConcurrency` is not supported) */ webWorkersLimit?: number - /** - * Background color of the canvas (also known as the clearColor) - * - * Can be a color name (red, blue, silver), a hexadecimal color (`#000000`, `#ccc`), - * or a color number in rgba order (`0xff0033ff`) - * - * Defauls to transparent (`0x00000000`) - * - */ - canvasColor?: string, - /** - * Enable inspector - * - * Enables the inspector tool for debugging and inspecting the application, the node tree - * will be replicated in the DOM and can be inspected using the browser's developer tools - * - * Defaults to `false` - */ - inspector?: boolean, - /** - * Add an extra margin to the viewport for earlier pre-loading of elements and components - * - * By default the Lightning renderer, only renders elements that are inside the defined viewport. - * Everything outside of these bounds is removed from the render tree. - * - * With the viewportMargin you have the option to _virtually_ increase the viewport area, - * to expedite the pre-loading of elements and / or delay the unloading of elements depending - * on their position in the (virtual) viewport - * - * The margin can be specified in 4 directions by defining an array [top, right, bottom, left], - * or as a single number which is then applied to all 4 directions equally. - * - * Defaults to `0` - */ - viewportMargin?: number | [number, number, number, number], - /** - * Configures the gpu memory settings used by the renderer - */ - gpuMemory?: { - /** - * Maximum GPU memory threshold (in `mb`) after which - * the renderer will immediately start cleaning up textures to free - * up graphical memory - * - * When setting to `0`, texture memory management is disabled - * - * @default `200` - */ - max?: number, - /** - * Target threshold of GPU memory usage, defined as a fraction of - * the max threshold. The renderer will attempt to keep memory - * usage below this target by cleaning up non-renderable textures - * - * @default `0.8` - */ - target?: number, - /** - * Interval at which regular texture cleanups occur (in `ms`) - * - * @default `5000` - */ - cleanupInterval?: number, - /** - * Baseline GPU memory usage of the App (in `mb`), without rendering any - * textures. This value will be used as a basis when calculating - * the total memory usage towards the max and target memory - * usage - * - * @default `25` - */ - baseline?: number, - /** - * Whether or not the max threshold should be considered - * as a strict number that can not be exceeded in any way - * - * When set to `true`, new textures won't be created when the - * max threshold has been reached, until agressive texture cleanup - * has brought the memory back down - * - * @default false - */ - strict?: boolean, - }, /** * Defines which mode the renderer should operate in: `webgl` or `canvas` * @@ -988,7 +1017,6 @@ declare module '@lightningjs/blits' { * Defaults to `webgl` */ renderMode?: RenderModes, - /** * The time, in milliseconds, after which Blits considers a key press a _hold_ key press * @@ -1019,14 +1047,6 @@ declare module '@lightningjs/blits' { * new Canvas element and inject it into the DOM */ canvas?: HTMLCanvasElement, - /** - * The maximum amount of time the renderer is allowed to process textures in a - * single frame. If the processing time exceeds this limit, the renderer will - * skip processing the remaining textures and continue rendering the frame. - * - * Defaults to `10` - */ - textureProcessingTimeLimit?: number, /** * Advanced renderer settings to override Blits launch settings, or configure * settings that are not officially exposed in Blits yet @@ -1049,15 +1069,6 @@ declare module '@lightningjs/blits' { * @default false */ announcer?: boolean - /** - * Maximum FPS at which the App will be rendered - * - * Lowering the maximum FPS value can improve the overall experience on lower end devices. - * Targetting a lower FPS may gives the CPU more time to construct each frame leading to a smoother rendering. - * - * Defaults to `0` which means no maximum - */ - maxFPS?: number } interface State { diff --git a/src/component/base/methods.js b/src/component/base/methods.js index ade11db1..b7961c35 100644 --- a/src/component/base/methods.js +++ b/src/component/base/methods.js @@ -23,6 +23,20 @@ import { Log } from '../../lib/log.js' import { removeGlobalEffects } from '../../lib/reactivity/effect.js' import { renderer } from '../../launch.js' +const rendererSettingsKeyMappings = { + w: 'appWidth', + h: 'appHeight', + gpuMemory: 'textureMemory', + viewportMargin: 'boundMargin', + pixelRatio: 'deviceLogicalPixelRatio', + renderQuality: 'devicePhysicalPixelRatio', + canvasColor: 'clearColor', + inspector: 'inspector', + fpsInterval: 'fpsUpdateInterval', + textureProcessingTimeLimit: 'textureProcessingTimeLimit', + maxFPS: 'targetFps', +} + export default { $focus: { /** @@ -185,6 +199,17 @@ export default { enumerable: true, configurable: false, }, + $settings: { + /** + * @this {import('../../component').BlitsComponent} + */ + value: function (key, value) { + renderer.setOptions({ [rendererSettingsKeyMappings[key]]: value }) + }, + writable: false, + enumerable: true, + configurable: false, + }, } /** From e3ba773ad291565ad43ae53e38eae2eeccad7a10 Mon Sep 17 00:00:00 2001 From: Suresh Kumar Gangumalla Date: Fri, 24 Oct 2025 19:18:56 +0530 Subject: [PATCH 2/3] Added support for dynamic update of blits settings - Some blits settings can now dynamically updated like debugLevel - Created Union with all runtime updatable settings keys Signed-off-by: Suresh Kumar Gangumalla --- index.d.ts | 335 ++++++++++++++++++---------------- src/component/base/methods.js | 6 + src/lib/log.js | 10 +- 3 files changed, 193 insertions(+), 158 deletions(-) diff --git a/index.d.ts b/index.d.ts index 7d6eb457..0a9a8947 100644 --- a/index.d.ts +++ b/index.d.ts @@ -293,8 +293,24 @@ declare module '@lightningjs/blits' { } } - type SettingsKey = keyof RendererSettings; - type SettingsValue = RendererSettings[K]; + type SettingsKey = + // Renderer specific settings keys + | "w" + | "h" + | "gpuMemory" + | "viewportMargin" + | "pixelRatio" + | "renderQuality" + | "canvasColor" + | "inspector" + | "fpsInterval" + | "textureProcessingTimeLimit" + | "maxFPS" + // Blits specific settings keys + | "debugLevel"; + + + type SettingsValue = Settings[K]; export type ComponentBase = { /** @@ -779,7 +795,13 @@ declare module '@lightningjs/blits' { type ReactivityModes = 'Proxy' | 'defineProperty' type RenderModes = 'webgl' | 'canvas' - export interface RendererSettings { + /** + * Settings + * + * Launcher function that sets up the Lightning renderer and instantiates + * the Blits App + */ + export interface Settings { /** * Width of the Application */ @@ -788,155 +810,6 @@ declare module '@lightningjs/blits' { * Height of the Application */ h?: number, - /** - * Configures the gpu memory settings used by the renderer - */ - gpuMemory?: { - /** - * Maximum GPU memory threshold (in `mb`) after which - * the renderer will immediately start cleaning up textures to free - * up graphical memory - * - * When setting to `0`, texture memory management is disabled - * - * @default `200` - */ - max?: number, - /** - * Target threshold of GPU memory usage, defined as a fraction of - * the max threshold. The renderer will attempt to keep memory - * usage below this target by cleaning up non-renderable textures - * - * @default `0.8` - */ - target?: number, - /** - * Interval at which regular texture cleanups occur (in `ms`) - * - * @default `5000` - */ - cleanupInterval?: number, - /** - * Baseline GPU memory usage of the App (in `mb`), without rendering any - * textures. This value will be used as a basis when calculating - * the total memory usage towards the max and target memory - * usage - * - * @default `25` - */ - baseline?: number, - /** - * Whether or not the max threshold should be considered - * as a strict number that can not be exceeded in any way - * - * When set to `true`, new textures won't be created when the - * max threshold has been reached, until agressive texture cleanup - * has brought the memory back down - * - * @default false - */ - strict?: boolean, - }, - /** - * Add an extra margin to the viewport for earlier pre-loading of elements and components - * - * By default the Lightning renderer, only renders elements that are inside the defined viewport. - * Everything outside of these bounds is removed from the render tree. - * - * With the viewportMargin you have the option to _virtually_ increase the viewport area, - * to expedite the pre-loading of elements and / or delay the unloading of elements depending - * on their position in the (virtual) viewport - * - * The margin can be specified in 4 directions by defining an array [top, right, bottom, left], - * or as a single number which is then applied to all 4 directions equally. - * - * Defaults to `0` - */ - viewportMargin?: number | [number, number, number, number], - /** - * Custom pixel ratio of the device used to convert dimensions - * and positions in the App code to the actual device logical coordinates - * - * Takes presedence over the `screenResolution` setting - * - * Defaults to 1 if not specified - */ - pixelRatio?: number, - /** - * Controls the quality of the rendered App. - * - * Setting a lower quality leads to less detail on screen, but can positively affect overall - * performance and smoothness of the App (i.e. a higher FPS). - * - * The render quality can be one of the following presets: - * - * - `low` => 66% quality - * - `medium` => 85% quality - * - `high` => 100% quality - * - `retina` => 200% quality - * - * It's also possible to provide a custom value as a (decimal) number: - * - * - `0.2` => 20% quality - * - `1.5` => 150% quality - * - * Defaults to 1 (high quality) when not specified - */ - renderQuality?: RenderQualities, - /** - * Background color of the canvas (also known as the clearColor) - * - * Can be a color name (red, blue, silver), a hexadecimal color (`#000000`, `#ccc`), - * or a color number in rgba order (`0xff0033ff`) - * - * Defauls to transparent (`0x00000000`) - * - */ - canvasColor?: string, - /** - * Enable inspector - * - * Enables the inspector tool for debugging and inspecting the application, the node tree - * will be replicated in the DOM and can be inspected using the browser's developer tools - * - * Defaults to `false` - */ - inspector?: boolean, - /** - * Interval in milliseconds to receive FPS updates - * - * @remarks - * If set to `0`, FPS updates will be disabled. - * - * @defaultValue `1000` (disabled) - */ - fpsInterval?: number, - /** - * The maximum amount of time the renderer is allowed to process textures in a - * single frame. If the processing time exceeds this limit, the renderer will - * skip processing the remaining textures and continue rendering the frame. - * - * Defaults to `10` - */ - textureProcessingTimeLimit?: number, - /** - * Maximum FPS at which the App will be rendered - * - * Lowering the maximum FPS value can improve the overall experience on lower end devices. - * Targetting a lower FPS may gives the CPU more time to construct each frame leading to a smoother rendering. - * - * Defaults to `0` which means no maximum - */ - maxFPS?: number - } - - /** - * Settings - * - * Launcher function that sets up the Lightning renderer and instantiates - * the Blits App - */ - export interface Settings extends RendererSettings{ /** * Whether to enable multithreaded */ @@ -949,6 +822,10 @@ declare module '@lightningjs/blits' { * Fonts to be used in the Application */ fonts?: Font[], + /** + * Effects to be used by DynamicShader + */ + effects?: ShaderEffect[], /** * Shaders to be used in the application */ @@ -999,7 +876,45 @@ declare module '@lightningjs/blits' { * - 2160 */ screenResolution?: ScreenResolutions, - + /** + * Controls the quality of the rendered App. + * + * Setting a lower quality leads to less detail on screen, but can positively affect overall + * performance and smoothness of the App (i.e. a higher FPS). + * + * The render quality can be one of the following presets: + * + * - `low` => 66% quality + * - `medium` => 85% quality + * - `high` => 100% quality + * - `retina` => 200% quality + * + * It's also possible to provide a custom value as a (decimal) number: + * + * - `0.2` => 20% quality + * - `1.5` => 150% quality + * + * Defaults to 1 (high quality) when not specified + */ + renderQuality?: RenderQualities, + /** + * Custom pixel ratio of the device used to convert dimensions + * and positions in the App code to the actual device logical coordinates + * + * Takes presedence over the `screenResolution` setting + * + * Defaults to 1 if not specified + */ + pixelRatio?: number + /** + * Interval in milliseconds to receive FPS updates + * + * @remarks + * If set to `0`, FPS updates will be disabled. + * + * @defaultValue `1000` (disabled) + */ + fpsInterval?: number /** * Maximum number of web workers to spin up simultaneously for offloading functionality such * as image loading to separate threads (when supported by the browser) @@ -1008,6 +923,102 @@ declare module '@lightningjs/blits' { * `navigator.hardwareConcurrency` (or 2 if `navigator.hardwareConcurrency` is not supported) */ webWorkersLimit?: number + /** + * Background color of the canvas (also known as the clearColor) + * + * Can be a color name (red, blue, silver), a hexadecimal color (`#000000`, `#ccc`), + * or a color number in rgba order (`0xff0033ff`) + * + * Defauls to transparent (`0x00000000`) + * + */ + canvasColor?: string, + /** + * Enable inspector + * + * Enables the inspector tool for debugging and inspecting the application, the node tree + * will be replicated in the DOM and can be inspected using the browser's developer tools + * + * Defaults to `false` + */ + inspector?: boolean, + /** + * Add an extra margin to the viewport for earlier pre-loading of elements and components + * + * By default the Lightning renderer, only renders elements that are inside the defined viewport. + * Everything outside of these bounds is removed from the render tree. + * + * With the viewportMargin you have the option to _virtually_ increase the viewport area, + * to expedite the pre-loading of elements and / or delay the unloading of elements depending + * on their position in the (virtual) viewport + * + * The margin can be specified in 4 directions by defining an array [top, right, bottom, left], + * or as a single number which is then applied to all 4 directions equally. + * + * Defaults to `0` + */ + viewportMargin?: number | [number, number, number, number], + /** + * Threshold in `Megabytes` after which all the textures that are currently not visible + * within the configured viewport margin will be be freed and cleaned up + * + * When passed `0` the threshold is disabled and textures will not be actively freed + * and cleaned up + * + * Defaults to `200` (mb) + * @deprecated + * Deprecated: use `gpuMemory` launch setting instead + */ + gpuMemoryLimit?: number, + /** + * Configures the gpu memory settings used by the renderer + */ + gpuMemory?: { + /** + * Maximum GPU memory threshold (in `mb`) after which + * the renderer will immediately start cleaning up textures to free + * up graphical memory + * + * When setting to `0`, texture memory management is disabled + * + * @default `200` + */ + max?: number, + /** + * Target threshold of GPU memory usage, defined as a fraction of + * the max threshold. The renderer will attempt to keep memory + * usage below this target by cleaning up non-renderable textures + * + * @default `0.8` + */ + target?: number, + /** + * Interval at which regular texture cleanups occur (in `ms`) + * + * @default `5000` + */ + cleanupInterval?: number, + /** + * Baseline GPU memory usage of the App (in `mb`), without rendering any + * textures. This value will be used as a basis when calculating + * the total memory usage towards the max and target memory + * usage + * + * @default `25` + */ + baseline?: number, + /** + * Whether or not the max threshold should be considered + * as a strict number that can not be exceeded in any way + * + * When set to `true`, new textures won't be created when the + * max threshold has been reached, until agressive texture cleanup + * has brought the memory back down + * + * @default false + */ + strict?: boolean, + }, /** * Defines which mode the renderer should operate in: `webgl` or `canvas` * @@ -1017,6 +1028,7 @@ declare module '@lightningjs/blits' { * Defaults to `webgl` */ renderMode?: RenderModes, + /** * The time, in milliseconds, after which Blits considers a key press a _hold_ key press * @@ -1047,6 +1059,14 @@ declare module '@lightningjs/blits' { * new Canvas element and inject it into the DOM */ canvas?: HTMLCanvasElement, + /** + * The maximum amount of time the renderer is allowed to process textures in a + * single frame. If the processing time exceeds this limit, the renderer will + * skip processing the remaining textures and continue rendering the frame. + * + * Defaults to `10` + */ + textureProcessingTimeLimit?: number, /** * Advanced renderer settings to override Blits launch settings, or configure * settings that are not officially exposed in Blits yet @@ -1069,6 +1089,15 @@ declare module '@lightningjs/blits' { * @default false */ announcer?: boolean + /** + * Maximum FPS at which the App will be rendered + * + * Lowering the maximum FPS value can improve the overall experience on lower end devices. + * Targetting a lower FPS may gives the CPU more time to construct each frame leading to a smoother rendering. + * + * Defaults to `0` which means no maximum + */ + maxFPS?: number } interface State { diff --git a/src/component/base/methods.js b/src/component/base/methods.js index b7961c35..b3394aa7 100644 --- a/src/component/base/methods.js +++ b/src/component/base/methods.js @@ -204,6 +204,12 @@ export default { * @this {import('../../component').BlitsComponent} */ value: function (key, value) { + //TODO: Additional eligible blits related settings update goes here + if (key === 'debugLevel') { + this.$log.level = value + return + } + // Renderer related settings update renderer.setOptions({ [rendererSettingsKeyMappings[key]]: value }) }, writable: false, diff --git a/src/lib/log.js b/src/lib/log.js index 114620c1..26fd19fc 100644 --- a/src/lib/log.js +++ b/src/lib/log.js @@ -38,13 +38,13 @@ const time = () => { * @returns {Object} Logger object with info, warn, debug, and error methods. */ const logger = (context) => { - const level = Settings.get('debugLevel') const log = {} + log.level = Settings.get('debugLevel') Object.defineProperty(log, 'info', { get() { return ( - ((level >= 1 || (Array.isArray(level) && level.indexOf('info') > -1)) && + ((log.level >= 1 || (Array.isArray(log.level) && log.level.indexOf('info') > -1)) && console.info.bind( window.console, `%c ⚡️ ${context} %c ${time()}`, @@ -59,7 +59,7 @@ const logger = (context) => { Object.defineProperty(log, 'warn', { get() { return ( - ((level >= 1 || (Array.isArray(level) && level.indexOf('warn') > -1)) && + ((log.level >= 1 || (Array.isArray(log.level) && log.level.indexOf('warn') > -1)) && console.warn.bind( window.console, `%c ⚡️ ${context} %c ${time()}`, @@ -74,7 +74,7 @@ const logger = (context) => { Object.defineProperty(log, 'error', { get() { return ( - ((level >= 1 || (Array.isArray(level) && level.indexOf('error') > -1)) && + ((log.level >= 1 || (Array.isArray(log.level) && log.level.indexOf('error') > -1)) && console.error.bind( window.console, `%c ⚡️ ${context} %c ${time()}`, @@ -89,7 +89,7 @@ const logger = (context) => { Object.defineProperty(log, 'debug', { get() { return ( - ((level >= 2 || (Array.isArray(level) && level.indexOf('debug') > -1)) && + ((log.level >= 2 || (Array.isArray(log.level) && log.level.indexOf('debug') > -1)) && console.debug.bind( window.console, `%c ⚡️ ${context} %c (${new Date().toLocaleTimeString([], { From e389c8746cff73452eede3b10eda294963082d67 Mon Sep 17 00:00:00 2001 From: Suresh Kumar Gangumalla Date: Mon, 27 Oct 2025 14:13:48 +0530 Subject: [PATCH 3/3] Update blits log level in runtime Signed-off-by: Suresh Kumar Gangumalla --- src/component/base/methods.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/component/base/methods.js b/src/component/base/methods.js index b3394aa7..16a5cdbc 100644 --- a/src/component/base/methods.js +++ b/src/component/base/methods.js @@ -206,7 +206,11 @@ export default { value: function (key, value) { //TODO: Additional eligible blits related settings update goes here if (key === 'debugLevel') { + // set app log level this.$log.level = value + + // set blits log level + Log.level = value return } // Renderer related settings update