---
title: Crash reporting
---
import EnvBadges from '@theme/EnvBadges';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
Report important environmental information when an error occurs or a process crashes.
## Installation
```bash
yarn add @boost/debug
```
```bash
pnpm add @boost/debug
```
```bash
npm install @boost/debug
```
## Reporting
Sometimes an application or script fails. Sometimes we want to write an error log with environmental
information about the failure. Boost supports this exact scenario.
Take advantage of crash reporting by importing and instantiating the
[`CrashReporter`](/api/debug/class/CrashReporter) class.
```ts
import { CrashReporter } from '@boost/debug';
const reporter = new CrashReporter();
```
The reporter supports a collection of chainable methods that log targeted information, grouped into
sections. View the API for more information on these methods.
```ts
reporter
.reportPackageVersions('@boost/*')
.reportBinaries()
.reportEnvVars()
.reportSystem();
```
If you'd like to add your own section and label value pairs, use
[`CrashReporter#addSection()`](/api/debug/class/CrashReporter#addSection), which requires a title,
and [`CrashReporter#add()`](/api/debug/class/CrashReporter#add), which accepts a label and one or
many values.
```ts
reporter
.addSection('User')
.add('ID', user.id)
.add('Name', user.name)
.add('Location', user.address, user.country);
```
Once all the information has been buffered, we can write the content to a log file by using
[`CrashReporter#write()`](/api/debug/class/CrashReporter#write), which requires an absolute file
path.
```ts
reporter.write(path.join(process.cwd(), 'error.log'));
```