Initial commit
This commit is contained in:
commit
137cb2ce13
215 changed files with 659023 additions and 0 deletions
31
src/GameCult.Logging.Unity/UnityLogger.cs
Normal file
31
src/GameCult.Logging.Unity/UnityLogger.cs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
using R3;
|
||||
using UnityEngine;
|
||||
|
||||
namespace GameCult.Logging.Unity
|
||||
{
|
||||
public class UnityLogger : ILogger
|
||||
{
|
||||
private readonly bool _isDebugBuild = Debug.isDebugBuild; // Cache Unity-specific
|
||||
|
||||
public void LogInfo(string message)
|
||||
{
|
||||
Observable.NextFrame().Subscribe(_ => Debug.Log($"[INFO] {message}"));
|
||||
}
|
||||
|
||||
public void LogWarning(string message)
|
||||
{
|
||||
Observable.NextFrame().Subscribe(_ => Debug.LogWarning($"[WARN] {message}"));
|
||||
}
|
||||
|
||||
public void LogError(string message)
|
||||
{
|
||||
Observable.NextFrame().Subscribe(_ => Debug.LogError($"[ERROR] {message}"));
|
||||
}
|
||||
|
||||
public void LogDebug(string message)
|
||||
{
|
||||
if (_isDebugBuild)
|
||||
Observable.NextFrame().Subscribe(_ => Debug.Log($"[DEBUG] {message}"));
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue