Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Remove log logic #577

Merged
merged 6 commits into from
May 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 0 additions & 38 deletions neo-cli/Program.cs
Original file line number Diff line number Diff line change
@@ -1,51 +1,13 @@
using Neo.CLI;
using System;
using System.IO;

namespace Neo
{
static class Program
{
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
using (FileStream fs = new FileStream("error.log", FileMode.Create, FileAccess.Write, FileShare.None))
using (StreamWriter w = new StreamWriter(fs))
if (e.ExceptionObject is Exception ex)
{
PrintErrorLogs(w, ex);
}
else
{
w.WriteLine(e.ExceptionObject.GetType());
w.WriteLine(e.ExceptionObject);
}
}

static void Main(string[] args)
{
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
var mainService = new MainService();
mainService.Run(args);
}

private static void PrintErrorLogs(StreamWriter writer, Exception ex)
{
writer.WriteLine(ex.GetType());
writer.WriteLine(ex.Message);
writer.WriteLine(ex.StackTrace);
if (ex is AggregateException ex2)
{
foreach (Exception inner in ex2.InnerExceptions)
{
writer.WriteLine();
PrintErrorLogs(writer, inner);
}
}
else if (ex.InnerException != null)
{
writer.WriteLine();
PrintErrorLogs(writer, ex.InnerException);
}
}
}
}
2 changes: 1 addition & 1 deletion neo-cli/neo-cli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Neo" Version="3.0.0-CI00892" />
<PackageReference Include="Neo" Version="3.0.0-CI00906" />
</ItemGroup>

<ItemGroup>
Expand Down