-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
UtilityAIDebug.cs
62 lines (52 loc) · 1.79 KB
/
UtilityAIDebug.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright (c) 2023 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/UtilityAI
using System.Diagnostics;
using System.Runtime.CompilerServices;
using UnityEngine;
using Debug = UnityEngine.Debug;
namespace Zor.UtilityAI.Debugging
{
/// <summary>
/// Class for logging the utility ai system.
/// </summary>
public static class UtilityAIDebug
{
/// <summary>
/// If it's defined, the utility ai system's logs are logged.
/// </summary>
public const string LogDefine = "UTILITY_AI_LOG";
/// <summary>
/// If it's defined, the utility ai system's warnings are logged.
/// </summary>
public const string WarningDefine = "UTILITY_AI_WARNING";
/// <summary>
/// If it's defined, the utility ai system's errors are logged.
/// </summary>
public const string ErrorDefine = "UTILITY_AI_ERROR";
private const string Format = "[UtilityAI] {0}.";
[Conditional(LogDefine), MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static void Log(string message)
{
Debug.LogFormat(Format, message);
}
[Conditional(WarningDefine), MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static void LogWarning(string message)
{
Debug.LogWarningFormat(Format, message);
}
[Conditional(WarningDefine), MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static void LogWarning(Object context, string message)
{
Debug.LogWarningFormat(context, Format, message);
}
[Conditional(ErrorDefine), MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static void LogError(string message)
{
Debug.LogErrorFormat(Format, message);
}
[Conditional(ErrorDefine), MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static void LogError(Object context, string message)
{
Debug.LogErrorFormat(context, Format, message);
}
}
}