Loading TOC...

MarkLogic Server 11.0 Product Documentation
console.dir

console.dir(
   obj as xs.anyAtomicType,
   [options as xs.anyAtomicType]
) as null

Summary

Logs an object to the App Server log file <install_dir>/Logs/<port>_ErrorLog.txt; where <install_dir> is the MarkLogic install directory, and <port> is the port number of the current App Server or "TaskServer" if the current request is running on the Task Server.

Parameters
obj Convert obj to a string and print the string in the log.
options Here are the options:
  • depth - controls how many times to recurse while formatting the object. Default is 2. Use null to recurse indefinitely.
  • colors - not used.

Example

const obj = {
      field1: {
	field2: {
          field3: {
            field4: 'value'
	  }
	}
      }
    };
console.dir(obj)
// output logged is:
// { field1: { field2: { field3: [Object] } } }

Example

const obj = {
      field1: {
        field2: {
          field3: {
            field4: 'value'
          }
        }
      }
    };
console.dir(obj, {depth: 1})
// output logged is:
// { field1: { field2: [Object] } }

Example

const obj = {
      field1: {
        field2: {
          field3: {
            field4: 'value'
          }
        }
      }
    };
console.dir(obj, {depth: null})
// output logged is:
// { field1: { field2: { field3: { field4: 'value' } } } }

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.