Danro-Jump/Assets/Scripts/Runtime/Debugging/DebugFileLogOptions.cs
Danil Iarosh 77186697f8 Prepare v0.1 gameplay and hardware foundation
Подробные изменения:

- Расширен основной gameplay loop: джетпак, новые платформы, оборудование, враги, прогрессия сложности и ограничения взаимодействий игрока.

- Добавлены Bootstrap-сервисы запуска приложения, защита, фокус окна, управление курсором и настройки сервисов через DI.

- Добавлена COM-интеграция с технической схемой Input System, обработкой кнопок/ADC, подсветкой и консольной диагностикой.

- Добавлен отдельный debug/logging модуль с каналами, обработчиками консоли и файловым выводом.

- Добавлены asmdef, link.xml, EditMode/PlayMode тесты и обновлена дорожная карта проекта.

Проверки:

- dotnet build .\\DanroJump.Runtime.csproj --no-restore

- dotnet build .\\DanroJump.Tests.EditMode.csproj --no-restore

- dotnet build .\\DanroJump.Tests.PlayMode.csproj --no-restore
2026-06-08 14:22:48 +03:00

51 lines
1.8 KiB
C#

using System.IO;
using UnityEngine;
namespace DanroJump.Debugging
{
/// <summary>
/// Настройки файлового обработчика отладочных сообщений.
/// </summary>
public readonly struct DebugFileLogOptions
{
private const string DefaultDirectory = "Logs";
private const string DefaultFileName = "debug.log";
public DebugFileLogOptions(
bool isEnabled,
bool usePersistentDataPath,
string directoryPath,
string fileName,
bool appendToFile,
bool writeSessionHeader,
int flushEveryEntries)
{
IsEnabled = isEnabled;
UsePersistentDataPath = usePersistentDataPath;
DirectoryPath = string.IsNullOrWhiteSpace(directoryPath) ? DefaultDirectory : directoryPath.Trim();
FileName = string.IsNullOrWhiteSpace(fileName) ? DefaultFileName : fileName.Trim();
AppendToFile = appendToFile;
WriteSessionHeader = writeSessionHeader;
FlushEveryEntries = Mathf.Max(1, flushEveryEntries);
}
public bool IsEnabled { get; }
public bool UsePersistentDataPath { get; }
public string DirectoryPath { get; }
public string FileName { get; }
public bool AppendToFile { get; }
public bool WriteSessionHeader { get; }
public int FlushEveryEntries { get; }
public string ResolveFilePath()
{
string root = UsePersistentDataPath ? Application.persistentDataPath : Application.dataPath;
string directory = Path.IsPathRooted(DirectoryPath)
? DirectoryPath
: Path.Combine(root, DirectoryPath);
return Path.Combine(directory, FileName);
}
}
}