Search notes:

Browser Object Model: console.log()

console.log(…) allows to write messages into the debugging console. Thus, it is a handy and cheap way to write debug messages.
If the message text is prefixed with %c, the second parameter of console.log can be given a set of CSS formatting rules that change the appearance of the written log messages.
With %s, %d and %f`, there is a rudimentary printf functionality.
In the following example, the content of an object (obj) is expanded using the JSON.stringify method.
<html>
<head>
  <meta charset="utf8">

<title>console.log</title>

<script type="text/JavaScript">

  function main() {
  
    console.log('');
    console.log('foo bar');
  
    obj = {x: 'eggs', y: 'why'};
    console.log(JSON.stringify(obj));
  
    console.log(
      '%cBIG and red',
      'color: #ff0000; font-size: 40px;'
    );
  
    console.log(
      '%cbold and blue',
      'color: #0000ff; font-weight: bold'
    );
  }

</script>
</head>
<body onload='main()'>

</body>
</html>
Github repository Browser-Object-Model, path: /console/log.html
This HTML document writes:

See also

In Firefox, the Web Console can be opened with ctrl+shift+K.
The console object of the browser object model

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758200281, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/web/browser/object-model/console/log/index(88): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78