Class LogNDC

A Nested Diagnostic Context, or NDC in short, is an instrument to distinguish interleaved log output from different sources. Log output is typically interleaved when a server handles multiple script calls near-simultaneously.

Constructor Summary 

This class does not have a constructor, so you cannot create it directly.

Method Summary 

MethodDescription
peek()Looks at the last diagnostic context at the top of this NDC without removing it.
pop()Clients should call this method before leaving a diagnostic context.
push(String)Push new diagnostic context information for the current script execution.
remove()Remove the diagnostic context for this script call.

Methods inherited from class Object 

assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values

Method Details 

peek() 

peek(): String

Looks at the last diagnostic context at the top of this NDC without removing it. The returned value is the value that was pushed last. If no context is available, then the empty string "" is returned.

Returns:

  • String The innermost diagnostic context.

pop() 

pop(): String

Clients should call this method before leaving a diagnostic context. The returned value is the value that was pushed last. If no context is available, then the empty string "" is returned. NOTE: The NDC is removed after every script execution.

Returns:

  • String The innermost diagnostic context.

push(String) 

push(message: String): void

Push new diagnostic context information for the current script execution.

Parameters:

  • message - - The new diagnostic context information.

remove() 

remove(): void

Remove the diagnostic context for this script call.


DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!