I want to suppress the version log (Babylon.js vX.X.X - WebGL) for making console tab clear
is it any way??
I want to suppress the version log (Babylon.js vX.X.X - WebGL) for making console tab clear
is it any way??
Hello!
A quick search in the BabylonJS source code reveals this:
So unfortunatelly no, you can’t prevent to log the BabylonJS version unless you compile your own BabylonJS library without this line.
Or you can redefine the console.log function to your own and make a decision what to log. To suppress everything:
console.log = function() {}
Yes, I was hoping it worked a little more like assert. There are Levels to logging. Thing you might be able to set Logger to report when there is an error. This is a really old part of the API.
Edit: I did not look close enough. Thought it was BABYLON.Logger, not console.log() being used.
I like how pixijs does it (especially in chrome!):
pixijs/hello.ts at dev · pixijs/pixijs (github.com)
You can call skipHello() and then it won’t log.
edit: I used that for a babylon physics plugin i worked on at one stage:
if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) {
// colors from logo
const topBlue = '#3B789A';
const sideBlue = '#405A68';
const bottomBlue = '#61B0E1';
const descriptions: string[] = ['Wammo', 'ManyBody', 'Spring'];
const url = 'http://github.com/brianzinn/wammo/';
const length = url.length + 9;
const args = ['']
args[0] += `%c %c %c ♥ %c ${' '.padEnd(url.length)} %c ♥ %c %c \n`
args.push(...[
`background: ${topBlue}; padding:5px 0;`,
`background: ${sideBlue}; padding:5px 0;`,
`color: red; background: ${bottomBlue}; padding:5px 0;`,
`background: ${topBlue}; padding:5px 0;`,
`color: red; background: ${bottomBlue}; padding:5px 0;`,
`background: ${sideBlue}; padding:5px 0;`,
`background: ${topBlue}; padding:5px 0;`,
]);
descriptions.forEach((d, i) => {
args[0] += `%c %c %c ${(i > 0 ? `- ${d}` : d).padEnd(length, ' ')}%c %c \n`;
args.push(...[
`background: ${topBlue}; padding:5px 0;`,
`background: ${sideBlue}; padding:5px 0;`,
`color: ${bottomBlue}; background: #030307; padding:5px 0;`,
`background: ${sideBlue}; padding:5px 0;`,
`background: ${topBlue}; padding:5px 0;`,
])
});
args[0] += ` %c %c ♥ %c ${url} %c ♥ %c %c \n\n`
args.push(...[
`background: ${sideBlue}; padding:5px 0;`,
`color: red; background: ${bottomBlue}; padding:5px 0;`,
`background: ${topBlue}; padding:5px 0;`,
`color: red; background: ${bottomBlue}; padding:5px 0;`,
`background: ${sideBlue}; padding:5px 0;`,
`background: ${topBlue}; padding:5px 0;`,
]);
window.console.log(...args);
}
else if (window.console) {
window.console.log(`Wammo Physics engine`);
}
Please excuse the graveyard post lol.
i cannot verify this will work for all babylon but it worked for me
I ran into the same Babylon banner spam while using a tool that pulls in BabylonJS under the hood.
I didn’t recompile Babylon — instead I suppressed the banner at runtime:
The version string is written with a plain console.log/info("Babylon.js vX.Y.Z …") very early in engine init.
If it happens inside a Web Worker you can’t intercept it, so I run the babylon stuff with offscreen: false to keep it on the main thread.
Then, at app startup, I wrap console.log/info and drop only lines that match /^Babylon\.js v/i.
That way the engine still works fine, but the “Babylon.js v…” banner never reaches my dev console.
So you don’t need to fork Babylon — just intercept the log call or disable the worker mode.