# Adding glows


A stack trace tells you where your app failed, but not what it was doing in the minutes before. Glows fill that gap. A glow is a small breadcrumb you leave in your code, and Flare shows the recent ones on the timeline of the next error report, in the order they happened.

## Adding a glow

```rust
use flareapp::Level;
use serde_json::json;

flareapp::glow("cart updated", Level::Info, json!({ "items": 3, "total": 49.95 }));
```

| Parameter | Type | Description |
|---|---|---|
| `name` | anything that converts into a `String` | A short description of what happened. |
| `level` | `flareapp::Level` | How serious it is. |
| `context` | anything that converts into a `serde_json::Value` | Extra data to show with the glow. Pass `json!({})` when you have none. |

The levels are `Debug`, `Info`, `Notice`, `Warning`, `Error`, `Critical`, `Alert` and `Emergency`:

```rust
use flareapp::Level;
use serde_json::json;

flareapp::glow("import started", Level::Debug, json!({}));
flareapp::glow("user signed in", Level::Info, json!({ "user_id": 42 }));
flareapp::glow("payment retried", Level::Warning, json!({ "attempt": 3 }));
```

A glow doesn't send anything to Flare on its own. It waits in the current scope until a report needs it.

## Glow lifecycle

Glows are kept in the current [scope](/docs/rust/data-collection/scopes). A scope holds the last 30, and drops the oldest when a new one comes in. They aren't cleared after a report, so two errors close to each other can show the same glows.

With the axum or Actix Web middleware, every request has its own scope. A glow added during a request only shows up on the errors of that request, and it's gone when the request ends. Outside of a request or job, glows go to the app-wide scope and stay there until newer ones push them out. Those show up on every error, also on the errors of a request.

## Logs as breadcrumbs

You might not need many glows at all. If you use `tracing` or `log` with the Flare integration, your recent log lines already show up on the same timeline, next to your glows. That's on by default for lines at INFO and above, and it doesn't send any logs to Flare unless you ask for that.

```rust
tracing::info!(order_id = 7, "order placed");
```

So a log line you'd write anyway doubles as a breadcrumb. Glows are for the moments you want on the timeline without writing a log line for them. See [breadcrumbs](/docs/rust/logs/introduction#breadcrumbs) to change the level or turn this off.

## Read more

- [Scopes](/docs/rust/data-collection/scopes): how glows stay with the request or job they belong to.
- [Adding custom context](/docs/rust/data-collection/adding-custom-context): data that belongs on the report itself, not on the timeline.
