Node.js v0.10.31API Manual - Folder

Console

  • Object

Used to direct to stdout and stderr Print character . Similar to most of Web Browser provided console Object functions , In this case, it's output to stdout or stderr.

When the output target is a terminal or file ,console Functions are synchronized ( To prevent information loss when exiting prematurely ). When the output target is a pipe, they are asynchronous ( Prevent clogging for too long ).

in other words , In the following example ,stdout
It's not blocked , and stderr It's clogged .

$ node script.js 2> error.log | tee info.log

In everyday use , You don't have to worry too much about blocking / The difference between non blocking , Unless you need to record a lot of data .

console.log([data], [...])

towards stdout Print and start a new line . This function can look like  printf()  That takes multiple parameters , such as :

console.log('count: %d', count);

Suppose no formatting element is found in the first string , that  util.inspect  Will be applied to each parameter . See  util.format().

console.info([data], [...])

Same as  console.log.

console.error([data], [...])

Same as  console.log, But output to
stderr.

console.warn([data], [...])

Same as  console.error.

console.dir(obj)

Yes  obj  Use  util.inspect  And output the result string to
stdout. This function ignores  obj  No matter what you define  inspect().

console.time(label)

Mark the time .

console.timeEnd(label)

End timer , Record output . Demo sample :

console.time('100-elements');
for (var i = 0; i < 100; i++) {
;
}
console.timeEnd('100-elements');

console.trace(message, [...])

Output through formatted message and stack trace to current position stderr 'Trace
:'
.

console.assert(value, [message], [...])

And  assert.ok()  Again , But the error message is used  util.format(message...)  To format .

Node.js v0.10.31API Manual - More about the console

  1. Node.js v0.10.31API Manual - event

    Node.js v0.10.31API Manual - Folder Events( event ) Node Many of the objects in it distribute Events : One net.Server Object distributes an event every time there is a new connection , One fs.readStrea ...

  2. Node.js v0.10.31API manual -DNS

    The original API Varieties , This is different from the previous translation and translation style Node.js v0.10.31API Manual - Folder DNS Use  require('dns')  Introduce this module . dns All the methods in the module use C-A ...

  3. Node.js V0.12 Performance optimization of new features

    v0.12 Long development cycle ( It's been nine months , And it's going on , It's the longest ever ) Give core teams and contributors ample opportunity to optimize performance . This article will introduce some of the most noteworthy ones . Write streams that support plug mode Now writable streams can ...

  4. 【 translate 】 Node.js v0.12 New features -- performance optimization

    original text : https://strongloop.com/strongblog/performance-node-js-v-0-12-whats-new/ January 21, 2014/in Comm ...

  5. 【 translate 】 Node.js v0.12 New features -- Cluster Mode adoption Round-Robin Load balancing

    original text :https://strongloop.com/strongblog/whats-new-in-node-js-v0-12-cluster-round-robin-load-balancing Ben ...

  6. Node.js V0.12 Performance optimization of new features

    v0.12 Long development cycle ( It's been nine months , And it's going on , It's the longest ever ) Give core teams and contributors ample opportunity to optimize performance . This article will introduce some of the most noteworthy ones . http://www.infoq. ...

  7. node.js Run configuration (vs code Non console output )

    node.js Run configuration (vs code Non console output ) node  To configure   simplify   vs code It's a very powerful compiler , Because it has all kinds of plug-ins that are easy to use . No installation in code runner Before plug in , Want to execute n ...

  8. node.js First time to know 10

    post request form.html <!DOCTYPE html> <html lang="en"> <head> <meta charse ...

  9. Node.js actual combat 10:“ flow ” yes Node.js One of the most powerful features .

    Flow is Nodejs Advanced applications for , Master the use of flow , To be really competent for NodeJS Development . Nodejs in , Flow is event based API, For managing and processing data , And it's efficient ! What is flow ? Flow is an abstract interface ,Node There are a lot of objects in ...

Random recommendation

  1. MyEclipse establish SpringMVC introduction HelloWorld project

    One . First , Create empty web project project : 1. 2. 3. Two . secondly , Import first jar package 1. take jar Package import SpringMVCHelloWorld\WebRoot\WEB-INF\lib Under the table of contents 3、 ... and ...

  2. Python Study 【 Fourth articles 】 User input and judgment

    User input : example 1. Write a small program for user to input password , The process is as follows : 1. Users enter their own user name 2. Print "Hello+ user name " #!/usr/bin/env python #name = ra ...

  3. linux Under the /dev/shm Catalog

    linux Under the /dev/shm Catalog linux in /dev There are usually some device files in the directory , For example, disk . Memory . Cameras, etc . /dev/shm This directory is linux The next virtual directory using memory , All the files in this directory are ...

  4. XMPP im

    XMPP:XMPP Is based on XML Peer to peer communication protocol for ,The Extensible Messaging and Presence Protocol( Scalable communication and presentation protocols ). XMPP It can be used for real-time communication of service class , surface ...

  5. database MySQL Jdbc JDBC There are six fixed steps of

    *0 Case study :    a) stay JavaScript Using regular expressions , stay JS The delimiter for regular expressions in is ://     var regexp = /^[0-9]+$/;     if(regexp.test(nu ...

  6. oracle auto number

    oracle auto number stay access There are automatically numbered data types in ,MSSQL and MYSQL There are also data types that grow automatically , You do not need to operate this field when inserting records , The data value will be obtained automatically , and oracle There is no automatic growth data type , We need to build ...

  7. [ Roof placement ] Android Picture loading asynchronously Android-Universal-Image-Loader

    I haven't updated my blog for nearly a month , Since this period of time, I have been involved in various affairs such as preparing my graduation thesis , There has been no time and energy to sink down and continue to learn and sort out some things . Just recently back on track , I just had a look at it these two days Android On the picture asynchronous loading of open source projects , Just ...

  8. webpack Learning notes —webpack install 、 Basic configuration

    Article structure : What is? webpack? install webpack 'webpack Basic configuration One . What is? webpack? I'm learning react Most of the articles are react and webpack Used in combination with , So I'm learning reac ...

  9. Inno Setup introduction ( 6、 ... and )&mdash;&mdash; Create a file in the program directory

    Create a folder using [dirs] Segment implementation , The code is as follows : [setup] ; Global settings , This paragraph must AppName=Test AppVerName=TEST DefaultDirName="E:\TES ...

  10. python Drop wechat api

    # -*- coding:utf-8 -*-import requestsimport jsonimport sys# Enterprise number and application related information corp_id = 'xxxx'corp_secret = ...