Danro-Jump/Assets/Scripts/Runtime/Debugging/RuntimeDebugInstaller.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

60 lines
2.4 KiB
C#

using UnityEngine;
using Zenject;
namespace DanroJump.Debugging
{
/// <summary>
/// Регистрирует глобальный runtime-сервис отладочного вывода в ProjectContext.
/// </summary>
public sealed class RuntimeDebugInstaller : MonoInstaller
{
[SerializeField] private bool enabledOnStartup = true;
[SerializeField] private DebugLogChannel enabledChannels = DebugLogChannel.All;
[SerializeField] private DebugLogOutput enabledOutputs = DebugLogOutput.UnityConsole | DebugLogOutput.CustomHandlers;
[Header("File Handler")]
[SerializeField] private bool fileLoggingEnabled;
[SerializeField] private bool fileLoggingUsePersistentDataPath = true;
[SerializeField] private string fileLoggingDirectory = "Logs";
[SerializeField] private string fileLoggingFileName = "debug.log";
[SerializeField] private bool fileLoggingAppendToFile = true;
[SerializeField] private bool fileLoggingWriteSessionHeader = true;
[SerializeField] [Min(1)] private int fileLoggingFlushEveryEntries = 1;
public override void InstallBindings()
{
var service = DebugLogService.GetOrCreate();
DebugLogOutput resolvedOutputs = fileLoggingEnabled
? enabledOutputs | DebugLogOutput.CustomHandlers
: enabledOutputs;
service.IsEnabled = enabledOnStartup;
service.EnabledChannels = enabledChannels;
service.EnabledOutputs = resolvedOutputs;
Container.Bind<IDebugLogService>().FromInstance(service).AsSingle();
if (fileLoggingEnabled)
{
Container.BindInterfacesAndSelfTo<FileDebugLogHandler>()
.AsSingle()
.WithArguments(CreateFileLogOptions())
.NonLazy();
}
Container.BindInterfacesTo<RuntimeDebugSceneInjector>().AsSingle().NonLazy();
}
private DebugFileLogOptions CreateFileLogOptions()
{
return new DebugFileLogOptions(
fileLoggingEnabled,
fileLoggingUsePersistentDataPath,
fileLoggingDirectory,
fileLoggingFileName,
fileLoggingAppendToFile,
fileLoggingWriteSessionHeader,
fileLoggingFlushEveryEntries);
}
}
}