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

Commit

Permalink
Remove log logic (#577)
Browse files Browse the repository at this point in the history
* Log akka errors

* dotnet-format

* Clean using

* add readonly

* Remove error.logs

* Update nuget
  • Loading branch information
shargon authored May 4, 2020
1 parent d63e958 commit 82033b4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 39 deletions.
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

0 comments on commit 82033b4

Please sign in to comment.