SystemContextEnhancer
File: system-context.enhancer.ts
Overview
The SystemContextEnhancer class enriches error objects with system-level context information. It includes details about the operating environment, system hardware, and the Node.js runtime. This class is particularly useful for diagnosing issues that may be dependent on the system where the error occurred.
Properties
hostname
The system's hostname.
cpuArch
The system's CPU architecture.
osType
The type of the operating system.
osRelease
The release version of the operating system.
systemUptime
The system's uptime in seconds.
Methods
refreshSystemInfo()
refreshSystemInfo()Refreshes the system uptime information. Useful when you need the most up-to-date info.
Usage Example:
systemContext.refreshSystemInfo();Getters
hostname
hostnameReturns the system's hostname.
cpuArch
cpuArchReturns the system's CPU architecture.
osType
osTypeReturns the type of the operating system.
osRelease
osReleaseReturns the release version of the operating system.
systemUptime
systemUptimeReturns the system's uptime in seconds.
Common Use-Cases
Debugging: The class is useful for debugging errors that may be system-specific.
Monitoring: Can be used in system monitoring solutions to add contextual information about the environment.
Was this helpful?