# VIPR Log File Plugin - Example

This is a simple example plugin that demonstrates how to create a VIPR plugin. It writes all logs to a text file in the results folder after inference completes.

## Purpose

This plugin serves as a minimal working example for developers who want to create their own VIPR plugins. It demonstrates:

- Plugin structure and organization
- Using the `load(app)` entry point
- Registering hooks for lifecycle events
- Accessing VIPR's app objects (config, datacollector, log, etc.)
- Proper entry point configuration in `pyproject.toml`

## Installation

```bash
cd example-plugin
pip install -e .
```

The plugin will be automatically discovered and loaded by VIPR.

## What It Does

When inference completes, this plugin:
1. Retrieves all logs from the DataCollector
2. Formats them with timestamps and log levels
3. Writes them to `logs.txt` in the result directory

## Files

- `vipr_log_file/__init__.py` - Plugin implementation
- `pyproject.toml` - Project configuration with entry point
- `README.md` - This file

## Usage

Once installed, the plugin runs automatically. No additional configuration needed.

Run any VIPR inference command:
```bash
vipr --config your_config.yaml inference run
```

After inference completes, check the results directory for `logs.txt`.

## Learning More

See the [Plugin Development Guide](https://codebase.helmholtz.cloud/vipr/vipr-framework/-/blob/main/docs-sphinx/docs/plugins/developing.md) for a step-by-step guide on creating your own plugins.
