Yes, you can format the console.log() with something like this:

console.log("%cExtra Large Yellow Text with Red Background", "background: red; color: yellow; font-size: x-large");

Note the %c preceding the text in the first argument and the style specifications in the second argument. The text will look like your example.

See Google's "Styling Console Output with CSS" or FireBug's Console Documentation for more details.

The documentation links also include some other neat tricks like including object links in a console log as well.

Answer from Smern on Stack Overflow
🌐
Educative
educative.io › answers › how-to-format-messages-in-consolelog-in-javascript
How to format messages in console.log() in JavaScript
You can use placeholders (%s, %d, %f, etc.) to format different data types in the logs, while %c allows applying CSS for styling. Logs can include strings, numbers, objects, arrays, and even CSS-styled text, allowing for a more structured and ...
Discussions

Can I control object formatting in the JavaScript snippet editor's console.log()? - Meta Stack Overflow
Given this code, can I alter the behavior of the Stack Overflow snippet editor to make the console.log() behave like Node.js? More on meta.stackoverflow.com
🌐 meta.stackoverflow.com
How do I change the output of console.log() for a class?
You can't make it happen by default. The console has its own internal logic for how it handles different kinds of objects and presents them in the console. For normal objects like a Cell instance it will (though this can vary based on where you're running this) show the object with its properties listed out. Unless you explicitly give the console a string, as you did with the second log, it will always do this for a Cell instance. Other options include: console.log(testCell.toString()); console.log(String(testCell)); console.log("" + testCell); More on reddit.com
🌐 r/learnjavascript
10
3
March 20, 2024
Can't use console.log in Lightning Web Components?
Try using: window.console.log(‘test’); We found that gets around it. More on reddit.com
🌐 r/salesforce
5
13
April 17, 2019
There a way to create a shortcut to print out console.log?
I use ES6 Snippets which lets me type “clg” and upon pressing enter converts it to console.log() More on reddit.com
🌐 r/vscode
4
0
June 27, 2021
🌐
Bugfender
bugfender.com › blog › javascript-console-log
JavaScript console.log() Method: Complete Guide with Examples | Bugfender
3 weeks ago - These techniques help us spot key information quickly and keep our logs organized when working on larger applications. console.log() supports format specifiers that let us insert values into a formatted string.
🌐
Dmitri Pavlutin
dmitripavlutin.com › console-log-tips
Handy Tips on Using console.log() - Dmitri Pavlutin
March 18, 2020 - Sometimes you might want a message containing multiple variables. Fortunately, console.log() can format the string in a sprintf() way using specifiers like %s, %i, etc.
🌐
DEV Community
dev.to › liaowow › beyond-console-log-3-ways-to-format-console-outputs-in-javascript-236p
Beyond console.log(): 3 Ways to Format Console Outputs in JavaScript - DEV Community
August 28, 2020 - Nonetheless, if you click on the triangle at the start of the output, both console.dir() and console.log() display nicely formatted JavaScript objects, neatly organized by property types and their values.
🌐
Chrome Developers
developer.chrome.com › docs › chrome devtools › format and style messages in the console
Format and style messages in the Console | Chrome DevTools | Chrome for Developers
February 21, 2021 - The output message will be converted according to the format specifier. Enter the following console command. console.log('I have %i apples and %d oranges.', 2, 3.5);
🌐
DevTools Tips
devtoolstips.org › tips › en › format-console-messages
Format console messages
November 10, 2021 - As a bonus, the %c formatter can also be used to style console messages with CSS properties! var el = document.body; console.log('%c There are %d elements in %O', 'color:lime;background:black;', el.childElementCount, el);
Find elsewhere
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › API › console › log_static
console: log() static method - Web APIs | MDN
console.log(val1) console.log(val1, /* …, */ valN) console.log(msg) console.log(msg, subst1, /* …, */ substN) ... A list of JavaScript values to output. A representation of each of these values is output to the console in the order given with some type of separation between each of them.
🌐
How-To Geek
howtogeek.com › home › ways to format console output in javascript
Ways to Format Console Output in JavaScript
February 9, 2021 - Most browsers automatically format the output with a red background to convey that an error occurred. ... console.error() , except a yellow background is normally applied to indicate the less severe warning status. Developers usually only pass a single argument to the above commands. Nonetheless, they all accept multiple arguments, which are automatically concatenated in the final output. ... Support for the last two varies by JavaScript engine.
🌐
Bennadel
bennadel.com › blog › 3941-styling-console-log-output-formatting-with-css.htm
Styling console.log() Output Formatting With CSS
December 16, 2020 - View this code in my JavaScript Demos project on GitHub. If you look at the Mozilla Developer docs for Console, you'll see that the Console object supports some nifty features like string substitution and CSS styling. Both of these features work by using a special token inside the first console.log() argument followed by a series of subsequent arguments that are used to modify the first argument.
🌐
GeeksforGeeks
geeksforgeeks.org › ways-to-format-console-output-in-javascript
Ways to Format Console Output in JavaScript | GeeksforGeeks
June 27, 2023 - Below are the approaches used to add Colors to JavaScript Console Outputs: Table of Content Using %CUsing ANSI escape code Approach 1: Using %CThe %c p ... The console object provides access to the browser's debugging console (or terminal in Node.js). It is used to log information, debug code, and interact with the runtime environment during development.Commonly Used console MethodsHere are the most frequently used methods of the console object:1. cons ... Here are different ways to format ...
🌐
Vercel
wirescript.vercel.app › blog › making-your-console-log-statements-stand-out
Making your console log statements stand out | The Wirescript
You can also add multiple styles in the same log by using multiple %c specifiers. console.log( "%cThis is actually %cvery interesting", "color: blue; font-size: 55px; background-color: yellow;", "font-size: 55px; background-color: blue; color: yellow" );
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › API › console
console - Web APIs - MDN Web Docs
Outputs a JavaScript object in the "generic JavaScript object formatting" style, usually in the form of an expandable tree. This is similar to console.dir(). ... Outputs an integer. ... Outputs a string. ... Outputs a floating-point value. ... Applies CSS style rules to all following text.
🌐
GitConnected
levelup.gitconnected.com › add-styles-and-formatting-to-your-console-log-messages-in-javascript-5f14819b1c5d
Add Styles and Formatting to Your console.log Messages in JavaScript
November 30, 2019 - ... %s → Formats the value as a string%i or %d → Formats the value as an integer%f → Formats the value as a floating point value%o → Formats the value as an expandable DOM element.
🌐
Chris Pietschmann
pietschsoft.com › post › 2023 › 12 › 06 › javascript-how-to-print-to-console-log
JavaScript: How to Print to Console, console.log, console.error, console.debug | Chris Pietschmann
December 6, 2023 - As you embark on your JavaScript journey, consider the following key takeaways: Foundational Knowledge: console.log() is your starting point for logging messages to the console. Master the basics of logging variables, strings, and the results of operations. Formatting Techniques: String concatenation, template literals, and formatting options within console.log() empower you to present information in a clear and structured manner.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript-console-log-method
JavaScript console.log() Method | GeeksforGeeks
January 9, 2025 - // Logging an Object const myObject = {Skill1:"HTML", Skill2:"CSS"}; console.log(myObject); // Logging an array const myArray = ["HTML", "CSS", "JavaScript"]; console.log(myArray);
🌐
Bitstack
blog.bitsrc.io › increase-readability-with-console-log-styling-with-chrome-devtools-a38a752d5096
Increase Readability with Console Log Styling with Chrome DevTools
February 10, 2023 - As discussed above, you can use the %c format specifier to style the console messages with CSS. A larger font is always easier to read than a smaller one. Therefore, you can increase the font size of your console output as follows. Besides, you can also use units like px or em to define the font size. console.log("%cHello World!","font-size: 20px"); console.log("%cHello World!","font-size: 5em")
🌐
Microsoft Learn
learn.microsoft.com › en-us › microsoft-edge › devtools-guide-chromium › console › console-log
Log messages in the Console tool - Microsoft Edge Developer documentation | Microsoft Learn
December 7, 2023 - Instead of logging text values, you can send any valid JavaScript or DOM references to the Console. The Console appropriately displays the various types of JavaScript values that you send to it from console log messages. The Console displays a filtered and formatted representation of the results.
🌐
David Lozzi
davidlozzi.com › 2021 › 03 › 16 › style-up-your-console-logs
Style up your console.logs – David Lozzi
January 11, 2023 - console.log('%cStyling is �un','color: #00ff33; font-size: 14px','text-transform:uppercase; font-size: 16px; color: #ff33dd') I’ve used this in a few different places, and will continue to do so. Some examples: console.error already formats your errors in all red.