-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathBlackboardDebug.cs
49 lines (42 loc) · 1.65 KB
/
BlackboardDebug.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
// Copyright (c) 2020-2023 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard
using System.Diagnostics;
using System.Runtime.CompilerServices;
using UnityEngine;
namespace Zor.SimpleBlackboard.Debugging
{
/// <summary>
/// Class for logging the blackboard system.
/// </summary>
public static class BlackboardDebug
{
/// <summary>
/// This define allows to log every change of the blackboard system. It can be too extensive. Use it only if
/// you have problems in the blackboard system and don't understand an origin of them at all.
/// </summary>
public const string LogDetailsDefine = "SIMPLE_BLACKBOARD_LOG_DETAILS";
public const string LogDefine = "SIMPLE_BLACKBOARD_LOG";
public const string WarningDefine = "SIMPLE_BLACKBOARD_LOG_WARNING";
public const string ErrorDefine = "SIMPLE_BLACKBOARD_LOG_ERROR";
private const string Format = "[SimpleBlackboard] {0}.";
[Conditional(LogDetailsDefine), MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static void LogDetails(string message)
{
UnityEngine.Debug.LogFormat(Format, message);
}
[Conditional(LogDefine), MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static void Log(string message)
{
UnityEngine.Debug.LogFormat(Format, message);
}
[Conditional(WarningDefine), MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static void LogWarning(string message)
{
UnityEngine.Debug.LogWarningFormat(Format, message);
}
[Conditional(ErrorDefine), MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static void LogError(string message)
{
UnityEngine.Debug.LogErrorFormat(Format, message);
}
}
}