refactor
This commit is contained in:
@@ -1,9 +1,5 @@
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Channels;
|
|
||||||
using Microsoft.Build.Execution;
|
using Microsoft.Build.Execution;
|
||||||
using Microsoft.Build.Framework;
|
|
||||||
using Microsoft.Build.Logging;
|
|
||||||
using SharpIDE.Application.Features.Logging;
|
using SharpIDE.Application.Features.Logging;
|
||||||
|
|
||||||
namespace SharpIDE.Application.Features.Build;
|
namespace SharpIDE.Application.Features.Build;
|
||||||
@@ -24,8 +20,6 @@ public class BuildService
|
|||||||
var normalOut = Console.Out;
|
var normalOut = Console.Out;
|
||||||
Console.SetOut(BuildTextWriter);
|
Console.SetOut(BuildTextWriter);
|
||||||
var terminalLogger = InternalTerminalLoggerFactory.CreateLogger();
|
var terminalLogger = InternalTerminalLoggerFactory.CreateLogger();
|
||||||
terminalLogger.Parameters = "FORCECONSOLECOLOR";
|
|
||||||
terminalLogger.Verbosity = LoggerVerbosity.Minimal;
|
|
||||||
var buildParameters = new BuildParameters
|
var buildParameters = new BuildParameters
|
||||||
{
|
{
|
||||||
Loggers =
|
Loggers =
|
||||||
|
|||||||
@@ -6,6 +6,12 @@ namespace SharpIDE.Application.Features.Logging;
|
|||||||
public class InternalTerminalLoggerFactory
|
public class InternalTerminalLoggerFactory
|
||||||
{
|
{
|
||||||
public static ILogger CreateLogger()
|
public static ILogger CreateLogger()
|
||||||
|
{
|
||||||
|
var logger = CreateLogger("FORCECONSOLECOLOR", LoggerVerbosity.Minimal);
|
||||||
|
return logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ILogger CreateLogger(string parameters, LoggerVerbosity loggerVerbosity)
|
||||||
{
|
{
|
||||||
var type = Type.GetType("Microsoft.Build.Logging.TerminalLogger, Microsoft.Build");
|
var type = Type.GetType("Microsoft.Build.Logging.TerminalLogger, Microsoft.Build");
|
||||||
|
|
||||||
@@ -26,6 +32,9 @@ public class InternalTerminalLoggerFactory
|
|||||||
obj: null,
|
obj: null,
|
||||||
parameters: [args, supportsAnsi, outputIsScreen, originalConsoleMode]);
|
parameters: [args, supportsAnsi, outputIsScreen, originalConsoleMode]);
|
||||||
|
|
||||||
return (ILogger)logger!; // This will be an ILogger (or INodeLogger) instance
|
var castLogger = (ILogger)logger!;
|
||||||
|
castLogger.Parameters = parameters;
|
||||||
|
castLogger.Verbosity = loggerVerbosity;
|
||||||
|
return castLogger;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user