45 lines
1.1 KiB
C#
45 lines
1.1 KiB
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace EscapeRoomEngine.Engine.Runtime.Utilities
|
|
{
|
|
public enum LogType
|
|
{
|
|
Important,
|
|
ModulePlacement,
|
|
ModuleInstantiation,
|
|
PassageConnection,
|
|
RoomGeneration,
|
|
RequirementResolution,
|
|
PuzzleFlow,
|
|
PuzzleDetail,
|
|
Portals,
|
|
Measuring
|
|
}
|
|
|
|
public class Logger : MonoBehaviour
|
|
{
|
|
/// <summary>
|
|
/// The active instance of the logger.
|
|
/// </summary>
|
|
private static Logger Instance { get; set; }
|
|
|
|
[Tooltip("Toggle logging on or off globally.")]
|
|
public bool loggingEnabled;
|
|
[Tooltip("This list determines what types of log messages should be displayed.")]
|
|
public List<LogType> typeFilter;
|
|
|
|
private void Awake()
|
|
{
|
|
Instance = this;
|
|
}
|
|
|
|
public static void Log(string message, LogType type)
|
|
{
|
|
if (Instance.loggingEnabled && Instance.typeFilter.Contains(type))
|
|
{
|
|
Debug.Log($"<b>[{type}]</b> {message}");
|
|
}
|
|
}
|
|
}
|
|
} |