split into multiple assemblies
This commit is contained in:
42
Assets/Engine/Runtime/Utilities/Logger.cs
Normal file
42
Assets/Engine/Runtime/Utilities/Logger.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace EscapeRoomEngine.Engine.Runtime.Utilities
|
||||
{
|
||||
public enum LogType
|
||||
{
|
||||
Important,
|
||||
ModulePlacement,
|
||||
PassageConnection,
|
||||
RoomGeneration,
|
||||
RequirementResolution,
|
||||
PuzzleFlow
|
||||
}
|
||||
|
||||
public class Logger : MonoBehaviour
|
||||
{
|
||||
public static Logger DefaultLogger
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_foundLogger == null)
|
||||
{
|
||||
_foundLogger = FindObjectOfType<Logger>();
|
||||
}
|
||||
return _foundLogger;
|
||||
}
|
||||
}
|
||||
private static Logger _foundLogger;
|
||||
|
||||
public bool loggingEnabled;
|
||||
public List<LogType> typeFilter;
|
||||
|
||||
public static void Log(string message, LogType type = LogType.Important)
|
||||
{
|
||||
if (DefaultLogger.loggingEnabled && DefaultLogger.typeFilter.Contains(type))
|
||||
{
|
||||
Debug.Log($"<b>[{type}]</b> {message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user