A global set of metadata that should be included with every log message. You can provide an object representing the metadata, or a function to be invoked to obtain the metadata object each time a message is logged. Each key-value pair of the object will be stringified and combined with the log message's per-call metadata. The keys you provide to each method is used solely to identify your entries so that you can later update or delete them - these keys are not included in log messages. Don't modify or remove metadata associated with keys that belong to someone else.

@note Each extra bit of metadata adds cost and overhead to the logging system. Avoid adding unnecessary or unnecessarily verbose metadata.

@see staticMetaData to access the global metadata.

Methods

Name Description
delete(key: string): void Remove metadata previously set using the specified key, so it will no longer be included with every logged message.  
set(key: string, metadata: LoggingMetaData): void Add or update some metadata to be included with every logged message.  

Defined in

Last Updated: 18 January, 2025