# 📚 Logs System

The **Logs** feature in nwMMOUpgrade allows you to automatically reset or clear log files generated by each station. This helps reduce disk usage and keeps log data manageable, especially for long-running servers.

```yaml
logs:
  enable: false
  reset-logs:
    enable: false
    every: "12h30m"
    timezone: "Asia/Bangkok"
```

## 🔁 How It Works

When `reset-logs.enable` is set to **true**, the system schedules a repeating task based on the interval defined in `every`.

#### ⏱️ Supported Time Units

You can define time intervals using:

| Unit   | Meaning          |
| ------ | ---------------- |
| **s**  | seconds          |
| **m**  | minutes          |
| **h**  | hours            |
| **d**  | days             |
| **mo** | months (30 days) |
| **y**  | years (365 days) |

#### Example:

```yaml
every: "1d6h45m"  # 1 day, 6 hours, 45 minutes
```

## 🌍 Timezone Configuration

The `timezone` field uses **IANA Time Zone Database** identifiers.\
This ensures scheduled tasks—like log resets—follow the correct local time.

#### 🔗 Valid Timezone List

<https://en.wikipedia.org/wiki/List_of_tz_database_time_zones>

Example:

```
Asia/Bangkok
America/New_York
Europe/London
```

***

## 📁 1. Log Folder & File Creation

Logs are stored in **separate files**, one for each station.\
A log file is created automatically the **first time** a station is used.

<figure><img src="https://1245303946-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEMKTTfYtO1c14jr3rkcH%2Fuploads%2FuGhwl9HyFdeTOqea0DLD%2Fimage.png?alt=media&#x26;token=c854f6ad-96e3-47fd-9b70-332ed34ff8d1" alt=""><figcaption></figcaption></figure>

***

## 📝 Example Log File Structure

Each log entry contains the following information:

| Field         | Description                                        |
| ------------- | -------------------------------------------------- |
| **timestamp** | The time when the log was recorded                 |
| **player**    | Name of the player                                 |
| **item**      | The item involved                                  |
| **success**   | Whether the operation succeeded (`true` / `false`) |
| **reason**    | Message or reason returned by the station          |

This ensures every upgrade, repair, combine, reroll, or other action is traceable for debugging or administrative review.

<figure><img src="https://1245303946-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEMKTTfYtO1c14jr3rkcH%2Fuploads%2FCfcbXyvHzi0ki7cBSNVI%2Fimage.png?alt=media&#x26;token=7c0a1d22-3da7-4b1e-a81d-c16e1ccd3ed4" alt=""><figcaption></figcaption></figure>

***
