-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBehaviorTreeDebug.cs
More file actions
60 lines (52 loc) · 1.83 KB
/
BehaviorTreeDebug.cs
File metadata and controls
60 lines (52 loc) · 1.83 KB
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
// Copyright (c) 2020-2023 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Behavior-Tree
using System.Diagnostics;
using System.Runtime.CompilerServices;
using UnityEngine;
using Debug = UnityEngine.Debug;
namespace Zor.BehaviorTree.Debugging
{
/// <summary>
/// Class for logging the behavior tree system.
/// </summary>
public static class BehaviorTreeDebug
{
/// <summary>
/// If it's defined, the behavior tree system's logs are logged.
/// </summary>
public const string LogDefine = "BEHAVIOR_TREE_LOG";
/// <summary>
/// If it's defined, the behavior tree system's warnings are logged.
/// </summary>
public const string WarningDefine = "BEHAVIOR_TREE_WARNING";
/// <summary>
/// If it's defined, the behavior tree system's errors are logged.
/// </summary>
public const string ErrorDefine = "BEHAVIOR_TREE_ERROR";
private const string Format = "[BehaviorTree] {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);
}
}
}