Skip to content

Commit

Permalink
add file logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Zt-freak committed Sep 29, 2021
1 parent 25c9605 commit 4b7976d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Castor/Castor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<ApplicationIcon>castor-icon.ico</ApplicationIcon>
<Company>ZtModArchive</Company>
<Copyright>MIT License</Copyright>
<Version>3.1.0</Version>
<Version>3.2.0</Version>
<PackageProjectUrl>https://github.com/ZtModArchive/Castor/tree/main/Castor</PackageProjectUrl>
<PackageIcon>castor-icon.ico</PackageIcon>
<PackageIconUrl />
Expand Down
12 changes: 8 additions & 4 deletions Castor/Services/CommandService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,16 @@ public void ConsoleCommand(string program, string arg)
process.StartInfo.UseShellExecute = false;
process.Start();

while (!process.StandardOutput.EndOfStream)
using (StreamWriter writer = new StreamWriter("castorlog.txt"))
{
string line = process.StandardOutput.ReadLine();
Console.WriteLine(line);
// do something with line
while (!process.StandardOutput.EndOfStream)
{
string line = process.StandardOutput.ReadLine();
Console.WriteLine($"{line}");
writer.WriteLine($"{line}");
}
}

process.WaitForExit();
}
}
Expand Down

0 comments on commit 4b7976d

Please sign in to comment.