# Logging

Gravity comes with a built-in logging tool that logs errors by default and allows you to record your own custom logs.

```javascript
log.create({ message, body, req, sendNotification, user, account });
```

You can pass 6 parameters to the log model:

| Parameter        | Type                 | Description                                                                                       |
| ---------------- | -------------------- | ------------------------------------------------------------------------------------------------- |
| message          | string               | description of log                                                                                |
| body             | json or error object | full error or response object                                                                     |
| req              | request object       | the model will extract the URL, HTTP method, **user\_id** *and* **account\_id** from the request. |
| sendNotification | true or false        | Determines if an email should be sent to you as soon as an error occurs (default is false)        |
| user             | string               | user ID to override the request object (or if not present in request)                             |
| account          | string               | account ID to override the request object                                                         |

### View Application Logs

You can see all of your application logs inside the [logs section of Mission Control](/mission-control/logs.md).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.usegravity.app/gravity-server/logging.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
