forked from Shardstone/trail-into-darkness
added in-game logger
This commit is contained in:
23
Packages/com.jovian.ingame-logging/Runtime/InGameLogger.cs
Normal file
23
Packages/com.jovian.ingame-logging/Runtime/InGameLogger.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Jovian.InGameLogging {
|
||||
public readonly struct InGameLogger {
|
||||
readonly IGameLogStore store;
|
||||
readonly LogChannel channel;
|
||||
|
||||
public InGameLogger(IGameLogStore store, LogChannel channel) {
|
||||
this.store = store;
|
||||
this.channel = channel;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Log(string message) {
|
||||
store.Add(channel, message);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Log(string message, string hexColor) {
|
||||
store.Add(channel, $"<color={hexColor}>{message}</color>");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user