This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
gameservicewarden/GameServiceWarden.Tests/GameServiceWarden.Core.Tests/XUnitLogger.cs
Harrison Deng 025999ab59
Some checks failed
ydeng/gameservicewarden/pipeline/head There was a failure building this commit
Updating to .Net 8.0.
2024-07-20 15:03:57 +00:00

32 lines
751 B
C#

using System;
using Xunit.Abstractions;
namespace GameServiceWarden.Core.Tests
{
public class XUnitLogger : ILogReceiver
{
public LogLevel Level => LogLevel.Debug;
public string Identifier => GetType().Name;
private ITestOutputHelper outputHelper;
public XUnitLogger(ITestOutputHelper output)
{
this.outputHelper = output;
}
public void Flush()
{
}
public void LogMessage(string message, DateTime time, LogLevel level)
{
try
{
outputHelper.WriteLine($"[{time.ToShortTimeString()}][{level.ToString()}]: {message}");
}
catch (InvalidOperationException) { };
}
}
}