> For the complete documentation index, see [llms.txt](https://docs.zipy.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zipy.ai/zipy-for-mobile/flutter-setup/custom-logging.md).

# Custom Logging

Logging Messages and Capturing Handled Exceptions enhances app reliability by recording key events and errors during app execution.

1. **Logging Messages:**

Logs various types of informational, debug, warning, or error messages to capture events, notifications, or actions within the application. It supports custom messages and timestamps for tracking events.

Here is the sample code snippet:

```dart
 Zipy.logMessage(
        message: 'Log Message Button Pressed',
        exceptionObj: {'zipy ': 'test'},
        maxLength: 100 // this is an optional field
        );
```

2. **Logging Exceptions:**

Logs exceptions and errors encountered by the application, providing detailed stack traces and context to aid in debugging and troubleshooting. This feature ensures critical data is logged promptly to diagnose and resolve issues.

Here is the sample code snippet:

```dart
Zipy.logException(
        message: 'Log Message Button Pressed',
        exceptionObj: {'zipy ': 'test'},
        maxLength: 100 // this is an optional field
        );
```

**Note:** For custom logging, if `maxLength` is not provided, it will default to capturing the full length.

This feature ensures you have the essential data to quickly diagnose and resolve issues, thereby improving your app's functionality and reliability.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.zipy.ai/zipy-for-mobile/flutter-setup/custom-logging.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
