How can I get the full object in Node.js's console.log(), rather than '[Object]'?

前端 未结 17 2927
一向
一向 2020-11-22 02:59

When debugging using console.log(), how can I get the full object?

const myObject = {
   \"a\":\"a\",
   \"b\":{
      \"c\":\"c\",
      \"d\":         


        
17条回答
  •  花落未央
    2020-11-22 03:19

    Both of these usages can be applied:

    // more compact, and colour can be applied (better for process managers logging)
    console.dir(queryArgs, { depth: null, colors: true });
    
    // get a clear list of actual values
    console.log(JSON.stringify(queryArgs, undefined, 2));
    

提交回复
热议问题