I created a small Python utility that helps analyze game crash logs and find possible reasons for crashes.

Instead of manually searching through thousands of log lines, you can simply load a crash log and get a readable report with detected errors, frequency and possible causes.

## Features:

* Detects common game crash errors
* Finds repeated problems
* Counts error occurrences
* Shows possible causes
* Generates a crash report
* Works with large log files
* No external services required

## Supported error types:

* Unity errors
* Unreal Engine crashes
* Minecraft mod/plugin problems
* Memory errors
* Network errors
* Missing files
* Generic application errors

## Example:

```
CRASH REPORT

Detected Error:
*********enceException

Occurrences:
47

Type:
SCRIPT ERROR

Possible Cause:
Broken script, plugin or mod conflict


Detected Error:
OutOfMemory

Occurrences:
12

Type:
MEMORY ERROR

Possible Cause:
Game ran out of available memory
```

## Voice Notification Support

The analyzer can also be combined with my previous Python Voice Lab project.

Example:

Instead of constantly checking logs manually:

"Game crash detected. Check the report."

The script can notify you about:

* game crashes;
* server problems;
* completed analysis;
* important events from background tasks.

Useful for gamers, mod users, server owners and developers.

## Built with:

Python

Libraries:

* re
* os
* datetime

## Planned improvements:

* GUI interface
* More game profiles
* Automatic log folder monitoring
* Discord/Telegram notifications
* More detailed error explanations

Feedback and suggestions are welcome.

Code:

Code:
import os
import re
from datetime import datetime


# ==========================================
# Game Crash Log Analyzer
# Python utility for analyzing game crash logs
# ==========================================


ERROR_DATABASE = {

    "*********enceException": {
        "type": "SCRIPT ERROR",
        "reason": "Broken script, plugin or mod conflict"
    },

    "OutOfMemory": {
        "type": "MEMORY ERROR",
        "reason": "Game ran out of available memory"
    },

    "EXCEPTION_ACCESS_VIOLATION": {
        "type": "CRASH",
        "reason": "Memory access violation, driver or mod issue"
    },

    "Fatal error": {
        "type": "CRITICAL",
        "reason": "Fatal crash detected"
    },

    "Failed to load mod": {
        "type": "MOD ERROR",
        "reason": "A modification failed during loading"
    },

    "Missing": {
        "type": "FILE ERROR",
        "reason": "Required file may be missing"
    },

    "Connection failed": {
        "type": "NETWORK ERROR",
        "reason": "Server connection problem"
    },

    "timeout": {
        "type": "NETWORK ERROR",
        "reason": "Connection timeout detected"
    }
}


def load_log(path):

    with open(
        path,
        "r",
        encoding="utf-8",
        errors="ignore"
    ) as file:

        return file.readlines()



def analyze(lines):

    problems = []

    for line in lines:

        for error, data in ERROR_DATABASE.items():

            if re.search(
                error,
                line,
                re.IGNORECASE
            ):

                problems.append({

                    "error": error,
                    "type": data["type"],
                    "reason": data["reason"],
                    "line": line.strip()

                })

    return problems



def create_report(results):

    print("\n==============================")
    print(" GAME CRASH ANALYZER REPORT")
    print("==============================\n")


    if not results:

        print("No known errors detected.")
        return



    counter = {}


    for item in results:

        counter[item["error"]] = (
            counter.get(item["error"], 0) + 1
        )


    print("Detected problems:\n")


    for error, count in counter.items():

        print(
            f"{error}: {count} time(s)"
        )


    print("\nDetails:\n")


    for item in results[:10]:

        print("------------------------------")

        print(
            "Type:",
            item["type"]
        )

        print(
            "Problem:",
            item["error"]
        )

        print(
            "Possible cause:",
            item["reason"]
        )

        print(
            "Log line:",
            item["line"]
        )


    save_report(results)



def save_report(results):

    os.makedirs(
        "reports",
        exist_ok=True
    )


    filename = (
        "reports/crash_report_"
        + datetime.now().strftime(
            "%Y%m%d_%H%M%S"
        )
        + ".txt"
    )


    with open(
        filename,
        "w",
        encoding="utf-8"
    ) as file:


        file.write(
            "GAME CRASH ANALYZER REPORT\n\n"
        )


        for item in results:

            file.write(
                f"""
Type:
{item['type']}

Error:
{item['error']}

Possible cause:
{item['reason']}

Log:
{item['line']}

------------------------------

"""
            )


    print(
        f"\nReport saved: {filename}"
    )



# ==================================================
# OPTIONAL VOICE NOTIFICATION
#
# You can connect this with Voice Lab TTS project.
#
# Example:
#
# import pyttsx3
#
# engine = pyttsx3.init()
# engine.say(
# "Game crash detected. Check the report."
# )
# engine.runAndWait()
#
# This allows voice alerts without watching logs.
# ==================================================



if __name__ == "__main__":


    print(
        "Game Crash Log Analyzer"
    )


    path = input(
        "\nEnter crash log file: "
    )


    if not os.path.exists(path):

        print(
            "File not found!"
        )

    else:

        logs = load_log(path)

        results = analyze(logs)

        create_report(results)
test_crash.log

Code:
[14:32:10] Starting game
[14:32:15] *********enceException: Object reference not set
[14:32:20] Failed to load mod ExampleMod
[14:32:22] *********enceException: Object reference not set
[14:32:25] Fatal error detected
[14:32:30] OutOfMemory exception
launch

Code:
python crash_analyzer.py
insert

Code:
test_crash.log
You'll get a report.