2019-06-21 07:50:24 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Runtime.CompilerServices;
|
|
|
|
|
using LibHac;
|
2019-09-21 19:29:10 +02:00
|
|
|
|
using LibHac.Fs;
|
2019-06-21 07:50:24 +02:00
|
|
|
|
|
|
|
|
|
namespace hactoolnet
|
|
|
|
|
{
|
|
|
|
|
public class ConsoleAccessLog : IAccessLog
|
|
|
|
|
{
|
2021-01-28 07:50:26 +01:00
|
|
|
|
public void Log(Result result, System.TimeSpan startTime, System.TimeSpan endTime, int handleId, string message, [CallerMemberName] string caller = "")
|
2019-06-21 07:50:24 +02:00
|
|
|
|
{
|
2019-09-30 23:15:31 +02:00
|
|
|
|
Console.WriteLine(AccessLogHelpers.BuildDefaultLogLine(result, startTime, endTime, handleId, message, caller));
|
2019-06-21 07:50:24 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class ProgressReportAccessLog : IAccessLog
|
|
|
|
|
{
|
|
|
|
|
private IProgressReport Logger { get; }
|
|
|
|
|
public ProgressReportAccessLog(IProgressReport logger)
|
|
|
|
|
{
|
|
|
|
|
Logger = logger;
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-28 07:50:26 +01:00
|
|
|
|
public void Log(Result result, System.TimeSpan startTime, System.TimeSpan endTime, int handleId, string message, [CallerMemberName] string caller = "")
|
2019-06-21 07:50:24 +02:00
|
|
|
|
{
|
2019-09-30 23:15:31 +02:00
|
|
|
|
Logger.LogMessage(AccessLogHelpers.BuildDefaultLogLine(result, startTime, endTime, handleId, message, caller));
|
2019-06-21 07:50:24 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class TextWriterAccessLog : IAccessLog
|
|
|
|
|
{
|
|
|
|
|
private TextWriter Logger { get; }
|
|
|
|
|
|
|
|
|
|
public TextWriterAccessLog(TextWriter logger)
|
|
|
|
|
{
|
|
|
|
|
Logger = logger;
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-28 07:50:26 +01:00
|
|
|
|
public void Log(Result result, System.TimeSpan startTime, System.TimeSpan endTime, int handleId, string message, [CallerMemberName] string caller = "")
|
2019-06-21 07:50:24 +02:00
|
|
|
|
{
|
2019-09-30 23:15:31 +02:00
|
|
|
|
Logger.WriteLine(AccessLogHelpers.BuildDefaultLogLine(result, startTime, endTime, handleId, message, caller));
|
2019-06-21 07:50:24 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|