56 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			56 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			C#
		
	
	
	
| using System.Collections;
 | |
| using System.Collections.Generic;
 | |
| using Unity.VisualScripting;
 | |
| using UnityEngine;
 | |
| 
 | |
| namespace WZ
 | |
| { 
 | |
|     public static class LoggerUtils
 | |
|     {
 | |
|         private static bool _enabled = false;
 | |
| 
 | |
|         public static bool Enabled
 | |
|         {
 | |
|             get => _enabled;
 | |
|             set => _enabled = value;
 | |
|         }
 | |
| 
 | |
|         public static void Debug(object message, Object context = null)
 | |
|         {
 | |
|             if (!_enabled) return;
 | |
|             Log($"[DEBUG][WZSDK] {message}", context);
 | |
|         }
 | |
| 
 | |
|         public static void Info(object message, Object context = null)
 | |
|         {
 | |
|             if (!_enabled) return;
 | |
|             Log($"[INFO][WZSDK] {message}", context);
 | |
|         }
 | |
| 
 | |
|         public static void Warning(object message, Object context = null)
 | |
|         {
 | |
|             if (!_enabled) return;
 | |
|             Log($"[WARNING][WZSDK] {message}", context);
 | |
|         }
 | |
| 
 | |
|         public static void Error(object message, Object context = null)
 | |
|         {
 | |
|             if (!_enabled) return;
 | |
|             Log($"[ERROR][WZSDK] {message}", context);
 | |
|         }
 | |
| 
 | |
|         private static void Log(string message, Object context = null)
 | |
|         {
 | |
|             if (context != null)
 | |
|             {
 | |
|                 UnityEngine.Debug.Log(message, context);
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 UnityEngine.Debug.Log(message);
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| }
 | |
| 
 |