{
  "source": "doc/api/console.markdown",
  "modules": [
    {
      "textRaw": "Console",
      "name": "console",
      "stability": 2,
      "stabilityText": "Stable",
      "desc": "<p>The module defines a <code>Console</code> class and exports a <code>console</code> object.\n\n</p>\n<p>The <code>console</code> object is a special instance of <code>Console</code> whose output is\nsent to stdout or stderr.\n\n</p>\n<p>For ease of use, <code>console</code> is defined as a global object and can be used\ndirectly without <code>require</code>.\n\n</p>\n",
      "globals": [
        {
          "textRaw": "console",
          "name": "console",
          "type": "global",
          "desc": "<p>For printing to stdout and stderr. Similar to the console object functions\nprovided by most web browsers, here the output is sent to stdout or stderr.\n\n</p>\n<p>The console functions are synchronous when the destination is a terminal or\na file (to avoid lost messages in case of premature exit) and asynchronous\nwhen it&#39;s a pipe (to avoid blocking for long periods of time).\n\n</p>\n<p>That is, in the following example, stdout is non-blocking while stderr\nis blocking:\n\n</p>\n<pre><code>$ node script.js 2&gt; error.log | tee info.log</code></pre>\n<p>In daily use, the blocking/non-blocking dichotomy is not something you\nshould worry about unless you log huge amounts of data.\n\n\n</p>\n",
          "methods": [
            {
              "textRaw": "console.log([data][, ...])",
              "type": "method",
              "name": "log",
              "desc": "<p>Prints to stdout with newline. This function can take multiple arguments in a\n<code>printf()</code>-like way. Example:\n\n</p>\n<pre><code>var count = 5;\nconsole.log(&#39;count: %d&#39;, count);\n// prints &#39;count: 5&#39;</code></pre>\n<p>If formatting elements are not found in the first string then <code>util.inspect</code>\nis used on each argument.  See [util.format()][] for more information.\n\n</p>\n",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "data",
                      "optional": true
                    },
                    {
                      "name": "...",
                      "optional": true
                    }
                  ]
                }
              ]
            },
            {
              "textRaw": "console.info([data][, ...])",
              "type": "method",
              "name": "info",
              "desc": "<p>Same as <code>console.log</code>.\n\n</p>\n",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "data",
                      "optional": true
                    },
                    {
                      "name": "...",
                      "optional": true
                    }
                  ]
                }
              ]
            },
            {
              "textRaw": "console.error([data][, ...])",
              "type": "method",
              "name": "error",
              "desc": "<p>Same as <code>console.log</code> but prints to stderr.\n\n</p>\n",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "data",
                      "optional": true
                    },
                    {
                      "name": "...",
                      "optional": true
                    }
                  ]
                }
              ]
            },
            {
              "textRaw": "console.warn([data][, ...])",
              "type": "method",
              "name": "warn",
              "desc": "<p>Same as <code>console.error</code>.\n\n</p>\n",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "data",
                      "optional": true
                    },
                    {
                      "name": "...",
                      "optional": true
                    }
                  ]
                }
              ]
            },
            {
              "textRaw": "console.dir(obj[, options])",
              "type": "method",
              "name": "dir",
              "desc": "<p>Uses <code>util.inspect</code> on <code>obj</code> and prints resulting string to stdout. This function\nbypasses any custom <code>inspect()</code> function on <code>obj</code>. An optional <em>options</em> object\nmay be passed that alters certain aspects of the formatted string:\n\n</p>\n<ul>\n<li><p><code>showHidden</code> - if <code>true</code> then the object&#39;s non-enumerable and symbol\nproperties will be shown too. Defaults to <code>false</code>.</p>\n</li>\n<li><p><code>depth</code> - tells <code>inspect</code> how many times to recurse while formatting the\nobject. This is useful for inspecting large complicated objects. Defaults to\n<code>2</code>. To make it recurse indefinitely pass <code>null</code>.</p>\n</li>\n<li><p><code>colors</code> - if <code>true</code>, then the output will be styled with ANSI color codes.\nDefaults to <code>false</code>. Colors are customizable, see below.</p>\n</li>\n</ul>\n",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "obj"
                    },
                    {
                      "name": "options",
                      "optional": true
                    }
                  ]
                }
              ]
            },
            {
              "textRaw": "console.time(timerName)",
              "type": "method",
              "name": "time",
              "desc": "<p>Starts a timer that can be used to compute the duration of an operation. Timers\nare identified by a unique name. Use the same name when you call\n<a href=\"#console_console_timeend_timername\"><code>console.timeEnd()</code></a> to stop the timer and\noutput the elapsed time in milliseconds. Timer durations are accurate to the\nsub-millisecond.\n\n</p>\n",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "timerName"
                    }
                  ]
                }
              ]
            },
            {
              "textRaw": "console.timeEnd(timerName)",
              "type": "method",
              "name": "timeEnd",
              "desc": "<p>Stops a timer that was previously started by calling\n<a href=\"#console_console_time_timername\"><code>console.time()</code></a> and prints the result to the\nconsole.\n\n</p>\n<p>Example:\n\n</p>\n<pre><code>console.time(&#39;100-elements&#39;);\nfor (var i = 0; i &lt; 100; i++) {\n  ;\n}\nconsole.timeEnd(&#39;100-elements&#39;);\n// prints 100-elements: 225.438ms</code></pre>\n",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "timerName"
                    }
                  ]
                }
              ]
            },
            {
              "textRaw": "console.trace(message[, ...])",
              "type": "method",
              "name": "trace",
              "desc": "<p>Print to stderr <code>&#39;Trace :&#39;</code>, followed by the formatted message and stack trace\nto the current position.\n\n</p>\n",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "message"
                    },
                    {
                      "name": "...",
                      "optional": true
                    }
                  ]
                }
              ]
            },
            {
              "textRaw": "console.assert(value[, message][, ...])",
              "type": "method",
              "name": "assert",
              "desc": "<p>Similar to [assert.ok()][], but the error message is formatted as\n<code>util.format(message...)</code>.\n\n</p>\n",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "value"
                    },
                    {
                      "name": "message",
                      "optional": true
                    },
                    {
                      "name": "...",
                      "optional": true
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "classes": [
        {
          "textRaw": "Class: Console",
          "type": "class",
          "name": "Console",
          "desc": "<p>Use <code>require(&#39;console&#39;).Console</code> or <code>console.Console</code> to access this class.\n\n</p>\n<pre><code>var Console = require(&#39;console&#39;).Console;\nvar Console = console.Console;</code></pre>\n<p>You can use <code>Console</code> class to custom simple logger like <code>console</code>, but with\ndifferent output streams.\n\n</p>\n",
          "signatures": [
            {
              "params": [
                {
                  "name": "stdout"
                },
                {
                  "name": "stderr",
                  "optional": true
                }
              ],
              "desc": "<p>Create a new <code>Console</code> by passing one or two writable stream instances.\n<code>stdout</code> is a writable stream to print log or info output. <code>stderr</code>\nis used for warning or error output. If <code>stderr</code> isn&#39;t passed, the warning\nand error output will be sent to the <code>stdout</code>.\n\n</p>\n<pre><code>var output = fs.createWriteStream(&#39;./stdout.log&#39;);\nvar errorOutput = fs.createWriteStream(&#39;./stderr.log&#39;);\n// custom simple logger\nvar logger = new Console(output, errorOutput);\n// use it like console\nvar count = 5;\nlogger.log(&#39;count: %d&#39;, count);\n// in stdout.log: count 5</code></pre>\n<p>The global <code>console</code> is a special <code>Console</code> whose output is sent to\n<code>process.stdout</code> and <code>process.stderr</code>:\n\n</p>\n<pre><code>new Console(process.stdout, process.stderr);</code></pre>\n"
            }
          ]
        }
      ],
      "type": "module",
      "displayName": "Console"
    }
  ]
}
