Can i suppress log of babylon version?

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() {}
5 Likes

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.

1 Like

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`);
  }
3 Likes